syft.core.store.storeable_object

Classes

StorableObject(id, data[, description, ...])

StorableObject is a wrapper over some Serializable objects, which we want to keep in an ObjectStore.

class syft.core.store.storeable_object.StorableObject(id, data, description=None, tags=None, read_permissions=None, search_permissions=None)[source]

Bases: syft.core.common.storeable_object.AbstractStorableObject

StorableObject is a wrapper over some Serializable objects, which we want to keep in an ObjectStore. The Serializable objects that we want to store have to be backed up in syft-proto in the StorableObject protobuffer, where you can find more details on how to add new types to be serialized.

This object is frozen, you cannot change one in place.

Parameters
  • id (UID) – the id at which to store the data.

  • data (Serializable) – A serializable object.

  • description (Optional[str]) – An optional string that describes what you are storing. Useful

  • when searching.

  • tags (Optional[List[str]]) – An optional list of strings that are tags used at search.

  • TODO – add docs about read_permission and search_permission

id

the id at which to store the data.

Type

UID

data

A serializable object.

Type

Serializable

description

An optional string that describes what you are storing. Useful

Type

Optional[str]

when searching.
tags

An optional list of strings that are tags used at search.

Type

Optional[List[str]]

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

clean_copy()[source]

This method return a copy of self, but clean up the search_permissions and read_permissions attributes.