async fn fetch_id<T: KVApiKey>(kv_api: &impl KVApi, generator: T) -> Result<u64, MetaError> {
    let res = kv_api
        .upsert_kv(UpsertKVAction {
            key: generator.to_key(),
            seq: MatchSeq::Any,
            value: Operation::Update(b"".to_vec()),
            value_meta: None,
        })
        .await?;

    // seq: MatchSeq::Any always succeeds
    let seq_v = res.result.unwrap();
    Ok(seq_v.seq)
}
/// Generate an id on metasrv.
///
/// Ids are categorized by generators.
/// Ids may not be consecutive.
Generate an id on metasrv.
Ids are categorized by generators.
Ids may not be consecutive.
Generate an id on metasrv . Ids are categorized by generators . Ids may not be consecutive .
async fn fetch_id<T: KVApiKey>(kv_api: &impl KVApi, generator: T) -> Result<u64, MetaError> {
    let res = kv_api
        .upsert_kv(UpsertKVAction {
            key: generator.to_key(),
            seq: MatchSeq::Any,
            value: Operation::Update(b"".to_vec()),
            value_meta: None,
        })
        .await?;
    // seq: MatchSeq::Any always succeeds
    let seq_v = res.result.unwrap();
    Ok(seq_v.seq)
}
async fn fetch_id < T : KVApiKey > ( kv_api : & impl KVApi , generator : T ) -> Result < u64 , MetaError > { let res = kv_api . upsert_kv ( UpsertKVAction { key : generator . to_key ( ) , seq : MatchSeq :: Any , value : Operation :: Update ( b" " . to_vec ( ) ) , value_meta : None , } ) . await ? ; // seq: MatchSeq::Any always succeeds let seq_v = res . result . unwrap ( ) ; Ok ( seq_v . seq ) }
Generate an id on metasrv.
Generate an id on metasrv .
kv_api
&impl KVApi
generator
T
kv_api
&impl KVApi
generator
T