api_impl::storage

Function open_persistent_object

Source
pub fn open_persistent_object(
    storage: Storage,
    id: &[u8],
    flags: HandleFlags,
) -> Result<ObjectHandle>
Expand description

Opens a new handle to an existing persistent object.

Returns Error::ItemNotFound: if storage does not correspond to a valid storage space, or if no object with id is found.

Returns Error::AccessConflict if any of the following hold:

  • The object is currently open with DATA_ACCESS_WRITE_META;
  • The object is currently open and flags contains DATA_ACCESS_WRITE_META
  • The object is currently open without DATA_ACCESS_READ_SHARE and flags contains DATA_ACCESS_READ or DATA_ACCESS_READ_SHARE;
  • The object is currently open with DATA_ACCESS_READ_SHARE, but flags does not;
  • The object is currently open without DATA_ACCESS_WRITE_SHARE and flags contains DATA_ACCESS_WRITE or DATA_ACCESS_WRITE_SHARE;
  • The object is currently open with DATA_ACCESS_WRITE_SHARE, but flags does not.