pub trait CoordinationTransport: Send + Sync {
// Required methods
fn acquire_epoch<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<FencingToken, CoordinationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_role_records<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<RoleRecords, CoordinationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn register<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
member: &'life2 MemberId,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn write_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
token: FencingToken,
lease: &'life2 Lease,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn describe<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<Option<FencingToken>, CoordinationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
The cluster operations that the coordination client performs.
A caller that wants the real cluster uses
BrokerTransport. A test uses the generated
MockCoordinationTransport.
Required Methods§
Sourcefn acquire_epoch<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<FencingToken, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acquire_epoch<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<FencingToken, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Mints a new epoch for role and fences the member that held it.
The transaction coordinator picks the epoch, so the value is
quorum-minted and monotonic. The implementation keeps the writer that
the epoch binds, and Self::write_lease uses it.
§Errors
Returns CoordinationError::Producer when the coordinator refuses
the call, and CoordinationError::Client when the connection to the
coordinator fails.
Sourcefn read_role_records<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<RoleRecords, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_role_records<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<RoleRecords, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the whole partition of role and returns the records in offset
order.
The read takes committed records only, so an aborted lease write is
invisible. The result holds the records of role and drops every
record of another role that shares the partition.
§Errors
Returns CoordinationError::Client when a fetch fails, and
CoordinationError::Record when a record of role does not decode.
Sourcefn register<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
member: &'life2 MemberId,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn register<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
member: &'life2 MemberId,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Appends the registration of member to the partition of role.
A candidate holds no epoch, so this append sits outside a transaction and carries no authority. Its offset is the join sequence that the succession rules rank on.
§Errors
Returns CoordinationError::Producer when the append fails, and
CoordinationError::Client when the connection fails.
Sourcefn write_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
token: FencingToken,
lease: &'life2 Lease,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
role: &'life1 Role,
token: FencingToken,
lease: &'life2 Lease,
) -> Pin<Box<dyn Future<Output = Result<(), CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes the lease of role in a transaction under token.
The broker rejects the write when a later member has taken role, and
that rejection is how a deposed holder learns it lost the role.
§Errors
Returns CoordinationError::Fenced when the broker rejects token.
Returns CoordinationError::NotHeld when this transport never minted
token. Returns CoordinationError::Producer for every other
failure of the write.
Sourcefn describe<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<Option<FencingToken>, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn describe<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 Role,
) -> Pin<Box<dyn Future<Output = Result<Option<FencingToken>, CoordinationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Asks the transaction coordinator which token holds role now.
The result is None when no member has ever held role. A third party
calls this to check the authority of a writer. It joins no group and it
takes no epoch.
§Errors
Returns CoordinationError::Admin when the coordinator lookup fails
or the coordinator reports a fault other than an unknown role.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".