actingweb.db.dynamodb package
Submodules
actingweb.db.dynamodb.actor module
- class actingweb.db.dynamodb.actor.Actor(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
ModelDynamoDB data model for an actor
- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 6
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_actors'
- write_capacity_units = 2
- creator
A unicode attribute
- creator_index = <actingweb.db.dynamodb.actor.CreatorIndex object>
- id
A unicode attribute
- passphrase
A unicode attribute
- class actingweb.db.dynamodb.actor.CreatorIndex[source]
Bases:
GlobalSecondaryIndex[Any]Secondary index on actor
- class Meta[source]
Bases:
object- attributes = {'creator': <pynamodb.attributes.UnicodeAttribute object>}
- index_name = 'creator-index'
- projection = <pynamodb.indexes.AllProjection object>
- read_capacity_units = 2
- write_capacity_units = 1
- creator
A unicode attribute
- class actingweb.db.dynamodb.actor.DbActor[source]
Bases:
objectDbActor does all the db operations for actor objects
- create(actor_id: str | None = None, creator: str | None = None, passphrase: str | None = None) bool[source]
Create a new actor
- get(actor_id: str | None = None) dict[str, Any] | None[source]
Retrieves the actor from the database
actingweb.db.dynamodb.attribute module
- class actingweb.db.dynamodb.attribute.Attribute(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
ModelDynamoDB data model for a property
- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 26
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_attributes'
- write_capacity_units = 2
- bucket
A unicode attribute
- bucket_name
A unicode attribute
- data
A JSON Attribute
Encodes JSON to unicode internally
- id
A unicode attribute
- name
A unicode attribute
- timestamp
An attribute for storing a UTC Datetime
- ttl_timestamp
A number attribute
- class actingweb.db.dynamodb.attribute.DbAttribute[source]
Bases:
objectDbProperty does all the db operations for property objects
The actor_id must always be set. get(), set() will set a new internal handle that will be reused by set() (overwrite attribute) and delete().
- static conditional_update_attr(actor_id=None, bucket=None, name=None, old_data=None, new_data=None, timestamp=None)[source]
Conditionally update an attribute only if current data matches old_data.
This provides atomic compare-and-swap functionality for race-free updates.
JSON comparison is order-independent - dict key ordering does not affect equality. If the caller’s old_data has different key ordering than stored data, we normalize both sides for comparison and use the stored ordering for the atomic update.
- Parameters:
actor_id – The actor ID
bucket – The bucket name
name – The attribute name
old_data – Expected current data value (for comparison)
new_data – New data to set if current matches old_data
timestamp – Optional timestamp
- Returns:
True if update succeeded (current matched old_data), False otherwise
- static get_attr(actor_id=None, bucket=None, name=None)[source]
Returns a dict of attributes from a bucket, each with data and timestamp
- static get_bucket(actor_id=None, bucket=None)[source]
Returns a dict of attributes from a bucket, each with data and timestamp
- static set_attr(actor_id=None, bucket=None, name=None, data=None, timestamp=None, ttl_seconds=None)[source]
Sets a data value for a given attribute in a bucket.
- Parameters:
actor_id – The actor ID
bucket – The bucket name
name – The attribute name
data – The data to store (JSON-serializable)
timestamp – Optional timestamp
ttl_seconds – Optional TTL in seconds from now. If provided, DynamoDB will automatically delete this item after expiry. Note: A 1-hour buffer is added for clock skew safety.
actingweb.db.dynamodb.peertrustee module
- class actingweb.db.dynamodb.peertrustee.DbPeerTrustee[source]
Bases:
objectDbPeerTrustee does all the db operations for property objects
The actor_id must always be set.
- create(actor_id=None, peerid=None, peer_type=None, baseuri=None, passphrase=None)[source]
Create a new peertrustee
- class actingweb.db.dynamodb.peertrustee.DbPeerTrusteeList[source]
Bases:
objectDbPeerTrusteeList does all the db operations for list of peertrustee objects
The actor_id must always be set.
- class actingweb.db.dynamodb.peertrustee.PeerTrustee(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
Model- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 1
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_peertrustees'
- write_capacity_units = 1
- baseuri
A unicode attribute
- id
A unicode attribute
- passphrase
A unicode attribute
- peerid
A unicode attribute
- type
A unicode attribute
actingweb.db.dynamodb.property module
- class actingweb.db.dynamodb.property.DbProperty(use_lookup_table: bool | None = None, indexed_properties: list[str] | None = None)[source]
Bases:
objectDbProperty does all the db operations for property objects
The actor_id must always be set. get(), set() and get_actor_id_from_property() will set a new internal handle that will be reused by set() (overwrite property) and delete().
- get(actor_id: str | None = None, name: str | None = None) str | None[source]
Retrieves the property from the database
- get_actor_id_from_property(name: str | None = None, value: str | None = None) str | None[source]
Reverse lookup: find actor by property value.
Uses lookup table if configured, otherwise falls back to GSI.
- Parameters:
name – Property name (e.g., “oauthId”)
value – Property value to search for
- Returns:
Actor ID if found, None otherwise
- class actingweb.db.dynamodb.property.DbPropertyList[source]
Bases:
objectDbPropertyList does all the db operations for list of property objects
The actor_id must always be set.
- class actingweb.db.dynamodb.property.Property(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
ModelDynamoDB data model for a property
- class Meta[source]
Bases:
object- host = None
- read_capacity_units = 26
- region = 'us-west-1'
- table_name = 'demo_actingweb_properties'
- write_capacity_units = 2
- id
A unicode attribute
- name
A unicode attribute
- property_index = <actingweb.db.dynamodb.property.PropertyIndex object>
- value
A unicode attribute
- class actingweb.db.dynamodb.property.PropertyIndex[source]
Bases:
GlobalSecondaryIndex[Any]Secondary index on property
- class Meta[source]
Bases:
object- attributes = {'value': <pynamodb.attributes.UnicodeAttribute object>}
- index_name = 'property-index'
- projection = <pynamodb.indexes.AllProjection object>
- read_capacity_units = 2
- write_capacity_units = 1
- value
A unicode attribute
- actingweb.db.dynamodb.property.logger = <Logger actingweb.db.dynamodb.property (WARNING)>
DbProperty handles all db operations for a property AWS DynamoDB is used as a backend.
actingweb.db.dynamodb.subscription module
- class actingweb.db.dynamodb.subscription.DbSubscription[source]
Bases:
objectDbSubscription does all the db operations for subscription objects
The actor_id must always be set.
- class actingweb.db.dynamodb.subscription.DbSubscriptionList[source]
Bases:
objectDbTrustList does all the db operations for list of trust objects
The actor_id must always be set.
- class actingweb.db.dynamodb.subscription.Subscription(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
Model- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 2
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_subscriptions'
- write_capacity_units = 1
- callback
A class for boolean attributes
- granularity
A unicode attribute
- id
A unicode attribute
- peer_sub_id
A unicode attribute
- peerid
A unicode attribute
- resource
A unicode attribute
- seqnr
A number attribute
- subid
A unicode attribute
- subtarget
A unicode attribute
- target
A unicode attribute
actingweb.db.dynamodb.subscription_diff module
- class actingweb.db.dynamodb.subscription_diff.DbSubscriptionDiff[source]
Bases:
objectDbSubscriptionDiff does all the db operations for subscription diff objects
The actor_id must always be set.
- class actingweb.db.dynamodb.subscription_diff.DbSubscriptionDiffList[source]
Bases:
objectDbSubscriptionDiffList does all the db operations for list of diff objects
The actor_id must always be set.
- class actingweb.db.dynamodb.subscription_diff.SubscriptionDiff(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
Model- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 2
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_subscriptiondiffs'
- write_capacity_units = 3
- diff
A unicode attribute
- id
A unicode attribute
- seqnr
A number attribute
- subid
A unicode attribute
- subid_seqnr
A unicode attribute
- timestamp
An attribute for storing a UTC Datetime
actingweb.db.dynamodb.trust module
- class actingweb.db.dynamodb.trust.DbTrust[source]
Bases:
objectDbTrust does all the db operations for trust objects
The actor_id must always be set.
- create(actor_id=None, peerid=None, baseuri='', peer_type='', relationship='', secret='', approved='', verified=False, peer_approved=False, verification_token='', desc='', peer_identifier=None, established_via=None, created_at=None, last_accessed=None, last_connected_via=None, client_name=None, client_version=None, client_platform=None, oauth_client_id=None, aw_supported=None, aw_version=None, capabilities_fetched_at=None)[source]
Create a new trust
- get(actor_id=None, peerid=None, token=None)[source]
Retrieves the trust from the database
Either peerid or token must be set. If peerid is set, token will be ignored.
- modify(baseuri=None, secret=None, desc=None, approved=None, verified=None, verification_token=None, peer_approved=None, peer_identifier=None, established_via=None, created_at=None, last_accessed=None, last_connected_via=None, client_name=None, client_version=None, client_platform=None, oauth_client_id=None, aw_supported=None, aw_version=None, capabilities_fetched_at=None)[source]
Modify a trust
If bools are none, they will not be changed.
- class actingweb.db.dynamodb.trust.DbTrustList[source]
Bases:
objectDbTrustList does all the db operations for list of trust objects
The actor_id must always be set.
- class actingweb.db.dynamodb.trust.SecretIndex[source]
Bases:
GlobalSecondaryIndexSecondary index on trust
- class Meta[source]
Bases:
object- attributes = {'secret': <pynamodb.attributes.UnicodeAttribute object>}
- index_name = 'secret-index'
- projection = <pynamodb.indexes.AllProjection object>
- read_capacity_units = 2
- write_capacity_units = 1
- secret
A unicode attribute
- class actingweb.db.dynamodb.trust.Trust(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]
Bases:
ModelData model for a trust relationship
- class Meta[source]
Bases:
object- aws_access_key_id = None
- aws_secret_access_key = None
- aws_session_token = None
- connect_timeout_seconds = 15
- extra_headers = None
- host = None
- max_pool_connections = 10
- max_retry_attempts = 3
- read_capacity_units = 5
- read_timeout_seconds = 30
- region = 'us-west-1'
- table_name = 'demo_actingweb_trusts'
- write_capacity_units = 2
- approved
A class for boolean attributes
- aw_supported
A unicode attribute
- aw_version
A unicode attribute
- baseuri
A unicode attribute
- capabilities_fetched_at
An attribute for storing a UTC Datetime
- client_name
A unicode attribute
- client_platform
A unicode attribute
- client_version
A unicode attribute
- created_at
An attribute for storing a UTC Datetime
- desc
A unicode attribute
- established_via
A unicode attribute
- id
A unicode attribute
- last_accessed
An attribute for storing a UTC Datetime
- last_connected_via
A unicode attribute
- oauth_client_id
A unicode attribute
- peer_approved
A class for boolean attributes
- peer_identifier
A unicode attribute
- peerid
A unicode attribute
- relationship
A unicode attribute
- secret
A unicode attribute
- secret_index = <actingweb.db.dynamodb.trust.SecretIndex object>
- type
A unicode attribute
- verification_token
A unicode attribute
- verified
A class for boolean attributes