Skip to main content

PartnerStore

Trait PartnerStore 

Source
pub trait PartnerStore: Send + Sync {
    // Required methods
    async fn upsert(
        &self,
        tenant_id: TenantId,
        record: &PartnerRecord,
    ) -> Result<(), EngineError>;
    async fn get(
        &self,
        tenant_id: TenantId,
        gln: &MarktpartnerCode,
    ) -> Result<Option<PartnerRecord>, EngineError>;
    async fn remove(
        &self,
        tenant_id: TenantId,
        gln: &MarktpartnerCode,
    ) -> Result<(), EngineError>;
    async fn list(
        &self,
        tenant_id: TenantId,
    ) -> Result<Vec<PartnerRecord>, EngineError>;

    // Provided methods
    async fn as4_endpoint(
        &self,
        tenant_id: TenantId,
        gln: &MarktpartnerCode,
    ) -> Result<Option<Box<str>>, EngineError> { ... }
    async fn api_webdienste_endpoint(
        &self,
        tenant_id: TenantId,
        gln: &MarktpartnerCode,
    ) -> Result<Option<Box<str>>, EngineError> { ... }
}
Expand description

Durable store for trading-partner master records.

Provides tenant-scoped access to PartnerRecords. Records are upserted when a new PARTIN message arrives or when makod bootstraps from static config.

All three operations are idempotent — reinserting the same record is safe.

§Blanket Arc implementation

Arc<S> implements PartnerStore whenever S: PartnerStore.

Required Methods§

Source

async fn upsert( &self, tenant_id: TenantId, record: &PartnerRecord, ) -> Result<(), EngineError>

Insert or update the record for (tenant_id, record.gln).

If a record already exists for this GLN, it is merged via PartnerRecord::merge_from_partin — i.e. the newer PARTIN-derived record wins, but a config-only bootstrap is always overwritten.

§Errors

Returns EngineError::Partner on storage failure.

Source

async fn get( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<Option<PartnerRecord>, EngineError>

Return the record for (tenant_id, gln), or None if not registered.

§Errors

Returns EngineError::Partner on storage failure.

Source

async fn remove( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<(), EngineError>

Remove the record for (tenant_id, gln).

No-op when the record does not exist.

§Errors

Returns EngineError::Partner on storage failure.

Source

async fn list( &self, tenant_id: TenantId, ) -> Result<Vec<PartnerRecord>, EngineError>

Return all records registered for tenant_id.

§Errors

Returns EngineError::Partner on storage failure.

Provided Methods§

Source

async fn as4_endpoint( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<Option<Box<str>>, EngineError>

Return the AS4 endpoint URL for gln, if known.

Convenience wrapper over get + as4_endpoint.

§Errors

Returns EngineError::Partner on storage failure.

Source

async fn api_webdienste_endpoint( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<Option<Box<str>>, EngineError>

Return the API-Webdienste Strom base URL for gln, if known.

Looks for a channel with qualifier "AW" (populated by the Verzeichnisdienst discovery path.

Convenience wrapper over get + api_webdienste_endpoint.

§Errors

Returns EngineError::Partner on storage failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: PartnerStore> PartnerStore for Arc<S>

Source§

async fn upsert( &self, tenant_id: TenantId, record: &PartnerRecord, ) -> Result<(), EngineError>

Source§

async fn get( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<Option<PartnerRecord>, EngineError>

Source§

async fn remove( &self, tenant_id: TenantId, gln: &MarktpartnerCode, ) -> Result<(), EngineError>

Source§

async fn list( &self, tenant_id: TenantId, ) -> Result<Vec<PartnerRecord>, EngineError>

Implementors§