class PutRequest(Request): OP_CODE = 0x01 key = m.Varbytes() tunits = m.SplitByte(default=[TimeUnits.DEFAULT, TimeUnits.DEFAULT]) lifespan = m.Uvarint(default=10, condition=lambda s: s.tunits[0] not in [TimeUnits.DEFAULT, TimeUnits.INFINITE]) max_idle = m.Uvarint(default=10, condition=lambda s: s.tunits[1] not in [TimeUnits.DEFAULT, TimeUnits.INFINITE]) value = m.Varbytes()
class ReplaceIfUnmodifiedRequest(Request): OP_CODE = 0x09 key = m.Varbytes() tunits = m.SplitByte(default=[TimeUnits.DEFAULT, TimeUnits.DEFAULT]) lifespan = m.Uvarint(default=10, condition=lambda s: s.tunits[0] not in [TimeUnits.DEFAULT, TimeUnits.INFINITE]) max_idle = m.Uvarint(default=10, condition=lambda s: s.tunits[1] not in [TimeUnits.DEFAULT, TimeUnits.INFINITE]) version = m.Bytes(8) value = m.Varbytes()
class GetWithMetadataResponse(Response): OP_CODE = 0x1C flag = m.Byte(condition=lambda s: s.header.status == Status.OK) created = m.Long(condition=lambda s: s.header.status == Status.OK and not(s.flag & 0x01)) lifespan = m.Uvarint(condition=lambda s: s.header.status == Status.OK and not(s.flag & 0x01)) last_used = m.Long(condition=lambda s: s.header.status == Status.OK and not(s.flag & 0x02)) max_idle = m.Uvarint(condition=lambda s: s.header.status == Status.OK and not(s.flag & 0x02)) version = m.Bytes(8, condition=lambda s: s.header.status == Status.OK) value = m.Varbytes(condition=lambda s: s.header.status == Status.OK)
class GetWithMetadataRequest(Request): OP_CODE = 0x1B key = m.Varbytes()
class GetWithVersionResponse(Response): OP_CODE = 0x12 version = m.Bytes(8, condition=lambda s: s.header.status == Status.OK) value = m.Varbytes(condition=lambda s: s.header.status == Status.OK)
class GetWithVersionRequest(Request): OP_CODE = 0x11 key = m.Varbytes()
class ContainsKeyRequest(Request): OP_CODE = 0x0F key = m.Varbytes()
class RemoveIfUnmodifiedResponse(Response): OP_CODE = 0x0E prev_value = m.Varbytes( condition=lambda s: s.header.status in [Status.OK_WITH_VALUE, Status.FAIL_WITH_VALUE])
class RemoveIfUnmodifiedRequest(Request): OP_CODE = 0x0D key = m.Varbytes() version = m.Bytes(8)
class RemoveResponse(Response): OP_CODE = 0x0C prev_value = m.Varbytes( condition=lambda s: s.header.status == Status.OK_WITH_VALUE)
class RemoveRequest(Request): OP_CODE = 0x0B key = m.Varbytes()
class PutIfAbsentResponse(Response): OP_CODE = 0x06 prev_value = m.Varbytes( condition=lambda s: s.header.status == Status.FAIL_WITH_VALUE)
class GetResponse(Response): OP_CODE = 0x04 value = m.Varbytes(condition=lambda s: s.header.status == Status.OK)
class GetRequest(Request): OP_CODE = 0x03 key = m.Varbytes()