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: Model

DynamoDB data model for an actor

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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: object

DbActor 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

delete()[source]

Deletes the actor in the database

get(actor_id: str | None = None) dict[str, Any] | None[source]

Retrieves the actor from the database

get_by_creator(creator: str | None = None) dict[str, Any] | list[dict[str, Any]] | None[source]

Retrieves the actor from db based on creator field

Returns None if none was found. If one is found, that one is loaded in the object. If more, all are returned.

modify(creator: str | None = None, passphrase: bytes | None = None) bool[source]

Modify an actor

class actingweb.db.dynamodb.actor.DbActorList[source]

Bases: object

DbActorList does all the db operations for list of actor objects

fetch()[source]

Retrieves the actors in 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: Model

DynamoDB data model for a property

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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: object

DbProperty 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

delete_attr(actor_id=None, bucket=None, name=None)[source]

Deletes an attribute in a bucket

static delete_bucket(actor_id=None, bucket=None)[source]

Deletes an entire bucket

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.

class actingweb.db.dynamodb.attribute.DbAttributeBucketList[source]

Bases: object

DbAttributeBucketList handles multiple buckets

The actor_id must always be set.

static delete(actor_id=None)[source]

Deletes all the attributes in the database

static fetch(actor_id=None)[source]

Retrieves all the attributes of an actor_id from the database

static fetch_timestamps(actor_id=None)[source]

Retrieves timestamps for all buckets of an actor_id

actingweb.db.dynamodb.peertrustee module

class actingweb.db.dynamodb.peertrustee.DbPeerTrustee[source]

Bases: object

DbPeerTrustee 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

delete()[source]

Deletes the peertrustee in the database after a get()

get(actor_id=None, peer_type=None, peerid=None)[source]

Retrieves the peertrustee from the database

modify(peer_type=None, baseuri=None, passphrase=None)[source]

Modify a peertrustee

If bools are none, they will not be changed.

class actingweb.db.dynamodb.peertrustee.DbPeerTrusteeList[source]

Bases: object

DbPeerTrusteeList does all the db operations for list of peertrustee objects

The actor_id must always be set.

delete()[source]

Deletes all the peertrustees in the database

fetch(actor_id=None)[source]

Retrieves the peer trustees of an actor_id from the database

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

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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: object

DbProperty 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().

delete() bool[source]

Deletes the property in the database after a get()

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

set(actor_id: str | None = None, name: str | None = None, value: Any = None) bool[source]

Sets a new value for the property name

class actingweb.db.dynamodb.property.DbPropertyList[source]

Bases: object

DbPropertyList does all the db operations for list of property objects

The actor_id must always be set.

delete() bool[source]

Deletes all the properties in the database

fetch(actor_id: str | None = None) dict[str, str] | None[source]

Retrieves the properties of an actor_id from the database

fetch_all_including_lists(actor_id: str | None = None) dict[str, str] | None[source]

Retrieves ALL properties including list properties - for internal PropertyListStore use

class actingweb.db.dynamodb.property.Property(hash_key: Any | None = None, range_key: Any | None = None, _user_instantiated: bool = True, **attributes: Any)[source]

Bases: Model

DynamoDB data model for a property

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

class Meta[source]

Bases: object

aws_access_key_id: str | None = None
aws_secret_access_key: str | None = None
aws_session_token: str | None = None
connect_timeout_seconds: int | None = None
extra_headers: dict[str, str] | None = None
host = None
max_pool_connections: int | None = None
max_retry_attempts: int | None = None
read_capacity_units = 26
read_timeout_seconds: int | None = None
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: object

DbSubscription does all the db operations for subscription objects

The actor_id must always be set.

create(actor_id=None, peerid=None, subid=None, granularity=None, target=None, subtarget=None, resource=None, seqnr=0, callback=False)[source]

Create a new subscription

delete()[source]

Deletes the subscription in the database

get(actor_id=None, peerid=None, subid=None)[source]

Retrieves the subscription from the database

modify(peerid=None, subid=None, granularity=None, target=None, subtarget=None, resource=None, seqnr=None, callback=None)[source]

Modify a subscription If bools are none, they will not be changed.

class actingweb.db.dynamodb.subscription.DbSubscriptionList[source]

Bases: object

DbTrustList does all the db operations for list of trust objects

The actor_id must always be set.

delete()[source]

Deletes all the subscriptions for an actor in the database

fetch(actor_id)[source]

Retrieves the subscriptions of an actor_id from the database as an array

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

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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: object

DbSubscriptionDiff does all the db operations for subscription diff objects

The actor_id must always be set.

create(actor_id=None, subid=None, diff='', seqnr=1)[source]

Create a new subscription diff

delete()[source]

Deletes the subscription diff in the database

get(actor_id=None, subid=None, seqnr=None)[source]

Retrieves the subscriptiondiff from the database

class actingweb.db.dynamodb.subscription_diff.DbSubscriptionDiffList[source]

Bases: object

DbSubscriptionDiffList does all the db operations for list of diff objects

The actor_id must always be set.

delete(seqnr=None)[source]

Deletes all the fetched subscription diffs in the database

Optional seqnr deletes up to (excluding) a specific seqnr

fetch(actor_id=None, subid=None)[source]

Retrieves the subscription diffs of an actor_id from the database as an array

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

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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: object

DbTrust 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

delete()[source]

Deletes the property in the database

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.

static is_token_in_db(actor_id=None, token=None)[source]

Returns True if token is found in db

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: object

DbTrustList does all the db operations for list of trust objects

The actor_id must always be set.

delete()[source]

Deletes all the properties in the database

fetch(actor_id)[source]

Retrieves the trusts of an actor_id from the database as an array

class actingweb.db.dynamodb.trust.SecretIndex[source]

Bases: GlobalSecondaryIndex

Secondary 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: Model

Data model for a trust relationship

exception DoesNotExist(msg: str | None = None, cause: Exception | None = None)

Bases: DoesNotExist

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