cattle_grid.account.processing¶
cattle_grid.account.processing ¶
The exchanges used by cattle_grid are using routing keys to make processing easier. The cattle_grid gateway takes these messages and readdresses them with routing keys based on an user. Here an user can have multiple actors.
Furthermore, convenience methods are provided to manage users and actors through a HTTP Api. This is in difference to interacting with the Fediverse, which is done through a message queue.
create_gateway_router ¶
create_gateway_router() -> RabbitRouter
annotations ¶
AccountFromRoutingKey
module-attribute
¶
Returns the account from the routing key
ActorForAccountFromMessage
module-attribute
¶
ActorForAccountFromMessage = Annotated[
ActorForAccount, Depends(actor_for_account_from_account)
]
The actor provided in the send message
ActorFromMessage
module-attribute
¶
The actor provided in the send message
MethodFromRoutingKey
module-attribute
¶
MethodFromRoutingKey = Annotated[
str, Depends(method_from_routing_key)
]
Returns the method of a trigger message
ResponderClass
dataclass
¶
ResponderClass(name: typing.Annotated[str, Dependant(name_from_routing_key)], publisher: Annotated[Callable, Dependant(AccountExchangePublisherClass)], reply_to: str | None = Context(required=True, cast=False))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
|
required |
publisher
|
Callable
|
|
required |
reply_to
|
str | None
|
|
Context(required=True, cast=False)
|
Source code in cattle_grid/account/processing/annotations.py
method_from_routing_key ¶
method_from_routing_key(
name: AccountName, routing_key: RoutingKey
) -> str
Extracts the method from the routing key
Source code in cattle_grid/account/processing/annotations.py
info ¶
cattle_drive_version ¶
router ¶
create_actor_handler
async
¶
create_actor_handler(
create_message: CreateActorRequest,
account: AccountFromRoutingKey,
session: CommittingSession,
responder: Responder,
) -> None
Creates an actor associated with the account.
Updating and deleting actors is done through trigger events.
Source code in cattle_grid/account/processing/router.py
handle_fetch
async
¶
handle_fetch(
msg: FetchMessage,
actor: ActorFromMessage,
internal_requester: InternalExchangeRequester,
responder: Responder,
)
Used to retrieve an object
Source code in cattle_grid/account/processing/router.py
schema ¶
get_async_api_schema ¶
get_async_api_schema() -> AsyncAPI
Returns the async api schema for cattle_grid Account processing
Source code in cattle_grid/account/processing/schema.py
trigger ¶
handle_trigger
async
¶
handle_trigger(
msg: TriggerMessage,
actor: ActorForAccountFromMessage,
method: MethodFromRoutingKey,
session: SqlSession,
rewrite_rules: RewriteRules,
publisher: ActivityExchangePublisher,
)
Used to trigger a method performed by the actor.
The main thing an actor can do is send activities to
the Fediverse. This can be done with send_message
.
This can be extended in cattle_grid through extensions.
However the methods to update the actor profile and delete the actor are also called via a trigger.