Exemple #1
0
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()
Exemple #2
0
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()
Exemple #3
0
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)
Exemple #4
0
class GetWithMetadataRequest(Request):
    OP_CODE = 0x1B
    key = m.Varbytes()
Exemple #5
0
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)
Exemple #6
0
class GetWithVersionRequest(Request):
    OP_CODE = 0x11
    key = m.Varbytes()
Exemple #7
0
class ContainsKeyRequest(Request):
    OP_CODE = 0x0F
    key = m.Varbytes()
Exemple #8
0
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])
Exemple #9
0
class RemoveIfUnmodifiedRequest(Request):
    OP_CODE = 0x0D
    key = m.Varbytes()
    version = m.Bytes(8)
Exemple #10
0
class RemoveResponse(Response):
    OP_CODE = 0x0C
    prev_value = m.Varbytes(
        condition=lambda s: s.header.status == Status.OK_WITH_VALUE)
Exemple #11
0
class RemoveRequest(Request):
    OP_CODE = 0x0B
    key = m.Varbytes()
Exemple #12
0
class PutIfAbsentResponse(Response):
    OP_CODE = 0x06
    prev_value = m.Varbytes(
        condition=lambda s: s.header.status == Status.FAIL_WITH_VALUE)
Exemple #13
0
class GetResponse(Response):
    OP_CODE = 0x04
    value = m.Varbytes(condition=lambda s: s.header.status == Status.OK)
Exemple #14
0
class GetRequest(Request):
    OP_CODE = 0x03
    key = m.Varbytes()