acstore.containers package

Submodules

acstore.containers.interface module

The attribute container interface.

class acstore.containers.interface.AttributeContainer[source]

Bases: object

The attribute container interface.

This is the base class for those object that exists primarily as a container of attributes with basic accessors and mutators.

The CONTAINER_TYPE class attribute contains a string that identifies the container type, for example the container type “event” identifiers an event object.

Attributes are public class members of a serializable type. Protected and private class members are not to be serialized, with the exception of those defined in _SERIALIZABLE_PROTECTED_ATTRIBUTES.

CONTAINER_TYPE = None
CopyFromDict(attributes)[source]

Copies the attribute container from a dictionary.

Parameters:

attributes (dict[str, object]) – attribute values per name.

CopyToDict()[source]

Copies the attribute container to a dictionary.

Returns:

attribute values per name.

Return type:

dict[str, object]

GetAttributeNames()[source]

Retrieves the names of all attributes.

Returns:

attribute names.

Return type:

list[str]

GetAttributeValuesHash()[source]

Retrieves a comparable string of the attribute values.

Returns:

hash of comparable string of the attribute values.

Return type:

int

GetAttributeValuesString()[source]

Retrieves a comparable string of the attribute values.

Returns:

comparable string of the attribute values.

Return type:

str

GetAttributes()[source]

Retrieves the attribute names and values.

Attributes that are set to None are ignored.

Yields:

tuple[str, object] – attribute name and value.

GetIdentifier()[source]

Retrieves the identifier.

The identifier is a storage specific value that should not be serialized.

Returns:

a unique identifier for the container.

Return type:

AttributeContainerIdentifier

MatchesExpression(expression)[source]

Determines if an attribute container matches the expression.

Parameters:

expression (code|str) – expression.

Returns:

True if the attribute container matches the expression, False

otherwise.

Return type:

bool

SetIdentifier(identifier)[source]

Sets the identifier.

The identifier is a storage specific value that should not be serialized.

Parameters:

identifier (AttributeContainerIdentifier) – identifier.

__init__()[source]

Initializes an attribute container.

class acstore.containers.interface.AttributeContainerIdentifier(name=None, sequence_number=None)[source]

Bases: object

The attribute container identifier.

The identifier is used to uniquely identify attribute containers. The value should be unique relative to an attribute container store.

name

name of the table (attribute container).

Type:

str

sequence_number

sequence number of the attribute container.

Type:

int

CopyFromString(identifier_string)[source]

Copies the identifier from a string representation.

Parameters:

identifier_string (str) – string representation.

CopyToString()[source]

Copies the identifier to a string representation.

Returns:

unique identifier or None.

Return type:

str

__init__(name=None, sequence_number=None)[source]

Initializes an attribute container identifier.

Parameters:
  • name (Optional[str]) – name of the table (attribute container).

  • sequence_number (Optional[int]) – sequence number of the attribute container.

acstore.containers.manager module

This file contains the attribute container manager class.

class acstore.containers.manager.AttributeContainersManager[source]

Bases: object

Class that implements the attribute container manager.

classmethod CreateAttributeContainer(container_type)[source]

Creates an instance of a specific attribute container type.

Parameters:

container_type (str) – container type.

Returns:

an instance of attribute container.

Return type:

AttributeContainer

Raises:

ValueError – if the container type is not supported.

classmethod DeregisterAttributeContainer(attribute_container_class)[source]

Deregisters an attribute container class.

The attribute container classes are identified based on their lower case container type.

Parameters:

attribute_container_class (type) – attribute container class.

Raises:

KeyError – if attribute container class is not set for the corresponding container type.

classmethod GetContainerTypes()[source]

Retrieves the container types of the registered attribute containers.

Returns:

container types.

Return type:

list[str]

classmethod GetSchema(container_type)[source]

Retrieves the schema of a registered attribute container.

Parameters:

container_type (str) – attribute container type.

Returns:

attribute container schema or an empty dictionary if

no schema available.

Return type:

dict[str, str]

Raises:

ValueError – if the container type is not supported.

classmethod RegisterAttributeContainer(attribute_container_class)[source]

Registers an attribute container class.

The attribute container classes are identified based on their lower case container type.

Parameters:

attribute_container_class (type) – attribute container class.

Raises:

KeyError – if attribute container class is already set for the corresponding container type.

classmethod RegisterAttributeContainers(attribute_container_classes)[source]

Registers attribute container classes.

The attribute container classes are identified based on their lower case container type.

Parameters:

attribute_container_classes (list[type]) – attribute container classes.

Raises:

KeyError – if attribute container class is already set for the corresponding container type.

Module contents