cadrumo.application.ledger.rule_repository module

Application-owned persistence contract for ledger classification rules.

Rule creation, priority ordering, and first-match policy belong to the ledger application surface. Encrypting those rules and selecting a concrete profile store belong to the persistence adapter. This module therefore owns only the repository operations the policy needs, their explicit bucket-scoped lifetime, and the rule’s natural object key.

ledger_classification_rule_object_key(rule)[source]

Return the canonical natural key for one classification rule.

Return type:

str

Parameters:

rule (LedgerClassificationRule)

class LedgerClassificationRuleRepositoryProtocol(*args, **kwargs)[source]

Bases: Protocol

Persistence operations required by classification-rule policy.

save(payload)[source]

Persist one rule under its content-addressed identity.

Return type:

None

Parameters:

payload (LedgerClassificationRule)

list_rules()[source]

Return rules in application precedence order.

Return type:

tuple[LedgerClassificationRule, ...]

class LedgerClassificationRuleRepositoryFactory(*args, **kwargs)[source]

Bases: Protocol

Construct a classification-rule repository for one profile bucket.

bind_ledger_classification_rule_repository_factory(factory)[source]

Bind one outward-composed classification-rule repository factory.

Return type:

Generator[LedgerClassificationRuleRepositoryFactory]

Parameters:

factory (LedgerClassificationRuleRepositoryFactory)

ledger_classification_rule_repository(*, bucket_id)[source]

Resolve the explicitly composed repository for bucket_id.

Return type:

LedgerClassificationRuleRepositoryProtocol

Parameters:

bucket_id (str)