def Bytes.endpoint.generation
mylsm-lsm-store@0.6.0.1 · mylsm.bend:279
import mylsm-lsm-store@0.6.0.1/mylsm.bend as Mylsm
import Base
import mylsm-lsm-store@0.6.0.1/src/coordinator/OwnerGenerationIo.bend as OwnerGenerationIo
import mylsm-lsm-store@0.6.0.1/src/coordinator/CoordinatorPolicy.bend as OwnerPolicy
279def Bytes.endpoint.generation(
280 endpoint: String,
281 result: Result<&1, &1, OwnerGenerationIo.Error, U32>
282) -> IO(Result<&1, &1, Bytes.Error, Bytes.Handle>):
283 match result:
284 case Fail{OwnerGenerationIo.Host{code, message}}:
285 IO.pure(Result<&1, &1, Bytes.Error, Bytes.Handle>, Fail{Io{code, message}})
286 case Fail{OwnerGenerationIo.Invalid{}}:
287 IO.pure(Result<&1, &1, Bytes.Error, Bytes.Handle>,
288 Fail{Corruption{"owner generation is invalid"}})
289 case Fail{OwnerGenerationIo.Exhausted{}}:
290 IO.pure(Result<&1, &1, Bytes.Error, Bytes.Handle>,
291 Fail{Corruption{"owner generation is exhausted"}})
292 case Done{generation}:
293 Bytes.remote.role(endpoint, generation, OwnerPolicy.open.role(
294 OwnerPolicy.LockBusy{}, OwnerPolicy.EndpointPresent{}))