Documentation ¶
Index ¶
- Variables
- func BytesDeepCopy(b []byte) []byte
- func NewDB(groupID uint64, nodeID uint64) statemachine.IStateMachine
- func RegisterPhxKVServerServer(s *grpc.Server, srv PhxKVServerServer)
- type DB
- type KVData
- func (*KVData) Descriptor() ([]byte, []int)
- func (m *KVData) GetIsdeleted() bool
- func (m *KVData) GetValue() []byte
- func (m *KVData) GetVersion() uint64
- func (m *KVData) Marshal() (dAtA []byte, err error)
- func (m *KVData) MarshalTo(dAtA []byte) (int, error)
- func (*KVData) ProtoMessage()
- func (m *KVData) Reset()
- func (m *KVData) Size() (n int)
- func (m *KVData) String() string
- func (m *KVData) Unmarshal(dAtA []byte) error
- func (m *KVData) XXX_DiscardUnknown()
- func (m *KVData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KVData) XXX_Merge(src proto.Message)
- func (m *KVData) XXX_Size() int
- func (m *KVData) XXX_Unmarshal(b []byte) error
- type KVRequest
- func (*KVRequest) Descriptor() ([]byte, []int)
- func (m *KVRequest) GetKey() string
- func (m *KVRequest) GetOperator() KVRequest_OperatorType
- func (m *KVRequest) GetSid() uint32
- func (m *KVRequest) GetValue() []byte
- func (m *KVRequest) GetVersion() uint64
- func (m *KVRequest) Marshal() (dAtA []byte, err error)
- func (m *KVRequest) MarshalTo(dAtA []byte) (int, error)
- func (*KVRequest) ProtoMessage()
- func (m *KVRequest) Reset()
- func (m *KVRequest) Size() (n int)
- func (m *KVRequest) String() string
- func (m *KVRequest) Unmarshal(dAtA []byte) error
- func (m *KVRequest) XXX_DiscardUnknown()
- func (m *KVRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KVRequest) XXX_Merge(src proto.Message)
- func (m *KVRequest) XXX_Size() int
- func (m *KVRequest) XXX_Unmarshal(b []byte) error
- type KVRequest_OperatorType
- type KVResponse
- func (*KVResponse) Descriptor() ([]byte, []int)
- func (m *KVResponse) GetCode() KVResponse_Code
- func (m *KVResponse) GetData() KVData
- func (m *KVResponse) Marshal() (dAtA []byte, err error)
- func (m *KVResponse) MarshalTo(dAtA []byte) (int, error)
- func (*KVResponse) ProtoMessage()
- func (m *KVResponse) Reset()
- func (m *KVResponse) Size() (n int)
- func (m *KVResponse) String() string
- func (m *KVResponse) Unmarshal(dAtA []byte) error
- func (m *KVResponse) XXX_DiscardUnknown()
- func (m *KVResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KVResponse) XXX_Merge(src proto.Message)
- func (m *KVResponse) XXX_Size() int
- func (m *KVResponse) XXX_Unmarshal(b []byte) error
- type KVResponse_Code
- type PaxosKV
- type PhxKVServerClient
- type PhxKVServerServer
- type UnimplementedPhxKVServerServer
- func (*UnimplementedPhxKVServerServer) Delete(ctx context.Context, req *KVRequest) (*KVResponse, error)
- func (*UnimplementedPhxKVServerServer) GetLocal(ctx context.Context, req *KVRequest) (*KVResponse, error)
- func (*UnimplementedPhxKVServerServer) Put(ctx context.Context, req *KVRequest) (*KVResponse, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotExist means the key is not exist ErrKeyNotExist = errors.New("key not exists") //ErrKeyVersionConflict means the key version is conflict ErrKeyVersionConflict = errors.New("key version conflict") )
View Source
var ( ErrInvalidLengthPaxoskv = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPaxoskv = fmt.Errorf("proto: integer overflow") )
View Source
var KVRequest_OperatorType_name = map[int32]string{
0: "READ",
1: "DELETE",
2: "WRITE",
}
View Source
var KVRequest_OperatorType_value = map[string]int32{
"READ": 0,
"DELETE": 1,
"WRITE": 2,
}
View Source
var KVResponse_Code_name = map[int32]string{
0: "OK",
1: "KEY_NOT_EXIST",
2: "VERSION_CONFLICT",
}
View Source
var KVResponse_Code_value = map[string]int32{
"OK": 0,
"KEY_NOT_EXIST": 1,
"VERSION_CONFLICT": 2,
}
Functions ¶
func NewDB ¶
func NewDB(groupID uint64, nodeID uint64) statemachine.IStateMachine
NewDB creates a new DB instance.
func RegisterPhxKVServerServer ¶
func RegisterPhxKVServerServer(s *grpc.Server, srv PhxKVServerServer)
Types ¶
type KVData ¶
type KVData struct { Value []byte `protobuf:"bytes,1,opt,name=value" json:"value"` Version uint64 `protobuf:"varint,2,opt,name=version" json:"version"` Isdeleted bool `protobuf:"varint,3,opt,name=isdeleted" json:"isdeleted"` }
func (*KVData) Descriptor ¶
func (*KVData) GetIsdeleted ¶
func (*KVData) GetVersion ¶
func (*KVData) ProtoMessage ¶
func (*KVData) ProtoMessage()
func (*KVData) XXX_DiscardUnknown ¶
func (m *KVData) XXX_DiscardUnknown()
func (*KVData) XXX_Marshal ¶
func (*KVData) XXX_Unmarshal ¶
type KVRequest ¶
type KVRequest struct { Key string `protobuf:"bytes,1,opt,name=key" json:"key"` Value []byte `protobuf:"bytes,2,opt,name=value" json:"value"` Version uint64 `protobuf:"varint,3,opt,name=version" json:"version"` Operator KVRequest_OperatorType `protobuf:"varint,4,opt,name=operator,enum=paxoskv.KVRequest_OperatorType" json:"operator"` Sid uint32 `protobuf:"varint,5,opt,name=sid" json:"sid"` }
func (*KVRequest) Descriptor ¶
func (*KVRequest) GetOperator ¶
func (m *KVRequest) GetOperator() KVRequest_OperatorType
func (*KVRequest) GetVersion ¶
func (*KVRequest) ProtoMessage ¶
func (*KVRequest) ProtoMessage()
func (*KVRequest) XXX_DiscardUnknown ¶
func (m *KVRequest) XXX_DiscardUnknown()
func (*KVRequest) XXX_Marshal ¶
func (*KVRequest) XXX_Unmarshal ¶
type KVRequest_OperatorType ¶
type KVRequest_OperatorType int32
const ( KVRequest_READ KVRequest_OperatorType = 0 KVRequest_DELETE KVRequest_OperatorType = 1 KVRequest_WRITE KVRequest_OperatorType = 2 )
func (KVRequest_OperatorType) Enum ¶
func (x KVRequest_OperatorType) Enum() *KVRequest_OperatorType
func (KVRequest_OperatorType) EnumDescriptor ¶
func (KVRequest_OperatorType) EnumDescriptor() ([]byte, []int)
func (KVRequest_OperatorType) String ¶
func (x KVRequest_OperatorType) String() string
func (*KVRequest_OperatorType) UnmarshalJSON ¶
func (x *KVRequest_OperatorType) UnmarshalJSON(data []byte) error
type KVResponse ¶
type KVResponse struct { Data KVData `protobuf:"bytes,1,opt,name=data" json:"data"` Code KVResponse_Code `protobuf:"varint,2,opt,name=code,enum=paxoskv.KVResponse_Code" json:"code"` }
func (*KVResponse) Descriptor ¶
func (*KVResponse) Descriptor() ([]byte, []int)
func (*KVResponse) GetCode ¶
func (m *KVResponse) GetCode() KVResponse_Code
func (*KVResponse) GetData ¶
func (m *KVResponse) GetData() KVData
func (*KVResponse) Marshal ¶
func (m *KVResponse) Marshal() (dAtA []byte, err error)
func (*KVResponse) ProtoMessage ¶
func (*KVResponse) ProtoMessage()
func (*KVResponse) Reset ¶
func (m *KVResponse) Reset()
func (*KVResponse) Size ¶
func (m *KVResponse) Size() (n int)
func (*KVResponse) String ¶
func (m *KVResponse) String() string
func (*KVResponse) Unmarshal ¶
func (m *KVResponse) Unmarshal(dAtA []byte) error
func (*KVResponse) XXX_DiscardUnknown ¶
func (m *KVResponse) XXX_DiscardUnknown()
func (*KVResponse) XXX_Marshal ¶
func (m *KVResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*KVResponse) XXX_Merge ¶
func (m *KVResponse) XXX_Merge(src proto.Message)
func (*KVResponse) XXX_Size ¶
func (m *KVResponse) XXX_Size() int
func (*KVResponse) XXX_Unmarshal ¶
func (m *KVResponse) XXX_Unmarshal(b []byte) error
type KVResponse_Code ¶
type KVResponse_Code int32
const ( KVResponse_OK KVResponse_Code = 0 KVResponse_KEY_NOT_EXIST KVResponse_Code = 1 KVResponse_VERSION_CONFLICT KVResponse_Code = 2 )
func (KVResponse_Code) Enum ¶
func (x KVResponse_Code) Enum() *KVResponse_Code
func (KVResponse_Code) EnumDescriptor ¶
func (KVResponse_Code) EnumDescriptor() ([]byte, []int)
func (KVResponse_Code) String ¶
func (x KVResponse_Code) String() string
func (*KVResponse_Code) UnmarshalJSON ¶
func (x *KVResponse_Code) UnmarshalJSON(data []byte) error
type PaxosKV ¶
type PaxosKV struct {
// contains filtered or unexported fields
}
PaxosKV is the main struct used pb the kv
type PhxKVServerClient ¶
type PhxKVServerClient interface { Put(ctx context.Context, in *KVRequest, opts ...grpc.CallOption) (*KVResponse, error) GetLocal(ctx context.Context, in *KVRequest, opts ...grpc.CallOption) (*KVResponse, error) Delete(ctx context.Context, in *KVRequest, opts ...grpc.CallOption) (*KVResponse, error) }
PhxKVServerClient is the client API for PhxKVServer service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewPhxKVServerClient ¶
func NewPhxKVServerClient(cc *grpc.ClientConn) PhxKVServerClient
type PhxKVServerServer ¶
type PhxKVServerServer interface { Put(context.Context, *KVRequest) (*KVResponse, error) GetLocal(context.Context, *KVRequest) (*KVResponse, error) Delete(context.Context, *KVRequest) (*KVResponse, error) }
PhxKVServerServer is the server API for PhxKVServer service.
type UnimplementedPhxKVServerServer ¶
type UnimplementedPhxKVServerServer struct { }
UnimplementedPhxKVServerServer can be embedded to have forward compatible implementations.
func (*UnimplementedPhxKVServerServer) Delete ¶
func (*UnimplementedPhxKVServerServer) Delete(ctx context.Context, req *KVRequest) (*KVResponse, error)
func (*UnimplementedPhxKVServerServer) GetLocal ¶
func (*UnimplementedPhxKVServerServer) GetLocal(ctx context.Context, req *KVRequest) (*KVResponse, error)
func (*UnimplementedPhxKVServerServer) Put ¶
func (*UnimplementedPhxKVServerServer) Put(ctx context.Context, req *KVRequest) (*KVResponse, error)
Click to show internal directories.
Click to hide internal directories.