Documentation
¶
Overview ¶
Package test is a generated GoMock package.
Index ¶
- Variables
- func RegisterReplicatorServer(s *grpc.Server, srv ReplicatorServer)
- type HelloRequest
- func (*HelloRequest) Descriptor() ([]byte, []int)
- func (*HelloRequest) ProtoMessage()
- func (m *HelloRequest) Reset()
- func (m *HelloRequest) String() string
- func (m *HelloRequest) XXX_DiscardUnknown()
- func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *HelloRequest) XXX_Merge(src proto.Message)
- func (m *HelloRequest) XXX_Size() int
- func (m *HelloRequest) XXX_Unmarshal(b []byte) error
- type HelloResponse
- func (*HelloResponse) Descriptor() ([]byte, []int)
- func (m *HelloResponse) GetID() string
- func (*HelloResponse) ProtoMessage()
- func (m *HelloResponse) Reset()
- func (m *HelloResponse) String() string
- func (m *HelloResponse) XXX_DiscardUnknown()
- func (m *HelloResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *HelloResponse) XXX_Merge(src proto.Message)
- func (m *HelloResponse) XXX_Size() int
- func (m *HelloResponse) XXX_Unmarshal(b []byte) error
- type MockReplicatorClient
- func (m *MockReplicatorClient) EXPECT() *MockReplicatorClientMockRecorder
- func (m *MockReplicatorClient) Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
- func (m *MockReplicatorClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
- type MockReplicatorClientMockRecorder
- type MockReplicatorServer
- type MockReplicatorServerMockRecorder
- type Option
- func WithGCInterval(interval time.Duration) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMetrics() Option
- func WithNodeID(nodeID string) Option
- func WithReadOnly() Option
- func WithRemoteNodesCheckInterval(interval time.Duration) Option
- func WithRemoteNodesProvider(provider RemoteNodesProvider) Option
- func WithReplicationChanCap(c int) Option
- type RemoteNodeOption
- type RemoteNodesProvider
- type ReplicatorClient
- type ReplicatorServer
- type Rplx
- func (rplx *Rplx) All() (notExpired map[string]int64, expired map[string]int64)
- func (rplx *Rplx) Delete(name string) error
- func (rplx *Rplx) Get(name string) (int64, error)
- func (rplx *Rplx) Hello(ctx context.Context, req *HelloRequest) (*HelloResponse, error)
- func (rplx *Rplx) StartReplicationServer(ln net.Listener, grpcOptions ...grpc.ServerOption) error
- func (rplx *Rplx) Stop()
- func (rplx *Rplx) Sync(ctx context.Context, req *SyncRequest) (*SyncResponse, error)
- func (rplx *Rplx) UpdateTTL(name string, ttl time.Time) error
- func (rplx *Rplx) Upsert(name string, delta int64) int64
- func (rplx *Rplx) VariablePartsCount(name string) (int, error)
- type SyncNodeValue
- func (*SyncNodeValue) Descriptor() ([]byte, []int)
- func (m *SyncNodeValue) GetValue() int64
- func (m *SyncNodeValue) GetVersion() int64
- func (*SyncNodeValue) ProtoMessage()
- func (m *SyncNodeValue) Reset()
- func (m *SyncNodeValue) String() string
- func (m *SyncNodeValue) XXX_DiscardUnknown()
- func (m *SyncNodeValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SyncNodeValue) XXX_Merge(src proto.Message)
- func (m *SyncNodeValue) XXX_Size() int
- func (m *SyncNodeValue) XXX_Unmarshal(b []byte) error
- type SyncRequest
- func (*SyncRequest) Descriptor() ([]byte, []int)
- func (m *SyncRequest) GetNodeID() string
- func (m *SyncRequest) GetVariables() map[string]*SyncVariable
- func (*SyncRequest) ProtoMessage()
- func (m *SyncRequest) Reset()
- func (m *SyncRequest) String() string
- func (m *SyncRequest) XXX_DiscardUnknown()
- func (m *SyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SyncRequest) XXX_Merge(src proto.Message)
- func (m *SyncRequest) XXX_Size() int
- func (m *SyncRequest) XXX_Unmarshal(b []byte) error
- type SyncResponse
- func (*SyncResponse) Descriptor() ([]byte, []int)
- func (m *SyncResponse) GetCode() int64
- func (*SyncResponse) ProtoMessage()
- func (m *SyncResponse) Reset()
- func (m *SyncResponse) String() string
- func (m *SyncResponse) XXX_DiscardUnknown()
- func (m *SyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SyncResponse) XXX_Merge(src proto.Message)
- func (m *SyncResponse) XXX_Size() int
- func (m *SyncResponse) XXX_Unmarshal(b []byte) error
- type SyncVariable
- func (*SyncVariable) Descriptor() ([]byte, []int)
- func (m *SyncVariable) GetNodesValues() map[string]*SyncNodeValue
- func (m *SyncVariable) GetTTL() int64
- func (m *SyncVariable) GetTTLVersion() int64
- func (*SyncVariable) ProtoMessage()
- func (m *SyncVariable) Reset()
- func (m *SyncVariable) String() string
- func (m *SyncVariable) XXX_DiscardUnknown()
- func (m *SyncVariable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SyncVariable) XXX_Merge(src proto.Message)
- func (m *SyncVariable) XXX_Size() int
- func (m *SyncVariable) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVariableNotExists returns if variable not exists ErrVariableNotExists = errors.New("variable not exists") // ErrVariableExpired returns if variable is expired ErrVariableExpired = errors.New("variable expired") )
Functions ¶
func RegisterReplicatorServer ¶
func RegisterReplicatorServer(s *grpc.Server, srv ReplicatorServer)
Types ¶
type HelloRequest ¶ added in v0.2.0
type HelloRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*HelloRequest) Descriptor ¶ added in v0.2.0
func (*HelloRequest) Descriptor() ([]byte, []int)
func (*HelloRequest) ProtoMessage ¶ added in v0.2.0
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) Reset ¶ added in v0.2.0
func (m *HelloRequest) Reset()
func (*HelloRequest) String ¶ added in v0.2.0
func (m *HelloRequest) String() string
func (*HelloRequest) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *HelloRequest) XXX_DiscardUnknown()
func (*HelloRequest) XXX_Marshal ¶ added in v0.2.0
func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*HelloRequest) XXX_Merge ¶ added in v0.2.0
func (dst *HelloRequest) XXX_Merge(src proto.Message)
func (*HelloRequest) XXX_Size ¶ added in v0.2.0
func (m *HelloRequest) XXX_Size() int
func (*HelloRequest) XXX_Unmarshal ¶ added in v0.2.0
func (m *HelloRequest) XXX_Unmarshal(b []byte) error
type HelloResponse ¶ added in v0.2.0
type HelloResponse struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*HelloResponse) Descriptor ¶ added in v0.2.0
func (*HelloResponse) Descriptor() ([]byte, []int)
func (*HelloResponse) GetID ¶ added in v0.2.0
func (m *HelloResponse) GetID() string
func (*HelloResponse) ProtoMessage ¶ added in v0.2.0
func (*HelloResponse) ProtoMessage()
func (*HelloResponse) Reset ¶ added in v0.2.0
func (m *HelloResponse) Reset()
func (*HelloResponse) String ¶ added in v0.2.0
func (m *HelloResponse) String() string
func (*HelloResponse) XXX_DiscardUnknown ¶ added in v0.2.0
func (m *HelloResponse) XXX_DiscardUnknown()
func (*HelloResponse) XXX_Marshal ¶ added in v0.2.0
func (m *HelloResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*HelloResponse) XXX_Merge ¶ added in v0.2.0
func (dst *HelloResponse) XXX_Merge(src proto.Message)
func (*HelloResponse) XXX_Size ¶ added in v0.2.0
func (m *HelloResponse) XXX_Size() int
func (*HelloResponse) XXX_Unmarshal ¶ added in v0.2.0
func (m *HelloResponse) XXX_Unmarshal(b []byte) error
type MockReplicatorClient ¶ added in v0.2.11
type MockReplicatorClient struct {
// contains filtered or unexported fields
}
MockReplicatorClient is a mock of ReplicatorClient interface
func NewMockReplicatorClient ¶ added in v0.2.11
func NewMockReplicatorClient(ctrl *gomock.Controller) *MockReplicatorClient
NewMockReplicatorClient creates a new mock instance
func (*MockReplicatorClient) EXPECT ¶ added in v0.2.11
func (m *MockReplicatorClient) EXPECT() *MockReplicatorClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReplicatorClient) Hello ¶ added in v0.2.11
func (m *MockReplicatorClient) Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
Hello mocks base method
func (*MockReplicatorClient) Sync ¶ added in v0.2.11
func (m *MockReplicatorClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
Sync mocks base method
type MockReplicatorClientMockRecorder ¶ added in v0.2.11
type MockReplicatorClientMockRecorder struct {
// contains filtered or unexported fields
}
MockReplicatorClientMockRecorder is the mock recorder for MockReplicatorClient
func (*MockReplicatorClientMockRecorder) Hello ¶ added in v0.2.11
func (mr *MockReplicatorClientMockRecorder) Hello(ctx, in interface{}, opts ...interface{}) *gomock.Call
Hello indicates an expected call of Hello
func (*MockReplicatorClientMockRecorder) Sync ¶ added in v0.2.11
func (mr *MockReplicatorClientMockRecorder) Sync(ctx, in interface{}, opts ...interface{}) *gomock.Call
Sync indicates an expected call of Sync
type MockReplicatorServer ¶ added in v0.2.11
type MockReplicatorServer struct {
// contains filtered or unexported fields
}
MockReplicatorServer is a mock of ReplicatorServer interface
func NewMockReplicatorServer ¶ added in v0.2.11
func NewMockReplicatorServer(ctrl *gomock.Controller) *MockReplicatorServer
NewMockReplicatorServer creates a new mock instance
func (*MockReplicatorServer) EXPECT ¶ added in v0.2.11
func (m *MockReplicatorServer) EXPECT() *MockReplicatorServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReplicatorServer) Hello ¶ added in v0.2.11
func (m *MockReplicatorServer) Hello(arg0 context.Context, arg1 *HelloRequest) (*HelloResponse, error)
Hello mocks base method
func (*MockReplicatorServer) Sync ¶ added in v0.2.11
func (m *MockReplicatorServer) Sync(arg0 context.Context, arg1 *SyncRequest) (*SyncResponse, error)
Sync mocks base method
type MockReplicatorServerMockRecorder ¶ added in v0.2.11
type MockReplicatorServerMockRecorder struct {
// contains filtered or unexported fields
}
MockReplicatorServerMockRecorder is the mock recorder for MockReplicatorServer
func (*MockReplicatorServerMockRecorder) Hello ¶ added in v0.2.11
func (mr *MockReplicatorServerMockRecorder) Hello(arg0, arg1 interface{}) *gomock.Call
Hello indicates an expected call of Hello
func (*MockReplicatorServerMockRecorder) Sync ¶ added in v0.2.11
func (mr *MockReplicatorServerMockRecorder) Sync(arg0, arg1 interface{}) *gomock.Call
Sync indicates an expected call of Sync
type Option ¶
type Option func(*Rplx)
Option describe Rplx option
func WithGCInterval ¶
WithGCInterval option for set garbage collect interval
func WithNodeID ¶ added in v0.2.0
WithNodeID option for specify rplx node name
func WithReadOnly ¶ added in v0.1.0
func WithReadOnly() Option
WithReadOnly option sets read only mode
func WithRemoteNodesCheckInterval ¶ added in v0.2.8
WithRemoteNodesCheckInterval option
func WithRemoteNodesProvider ¶ added in v0.2.8
func WithRemoteNodesProvider(provider RemoteNodesProvider) Option
WithRemoteNodesProvider option
func WithReplicationChanCap ¶
WithReplicationChanCap option for set replication channel capacity
type RemoteNodeOption ¶ added in v0.2.8
type RemoteNodeOption struct { Addr string DialOpts []grpc.DialOption SyncInterval time.Duration MaxBufferSize int ConnectionInterval time.Duration WaitSyncCount int }
RemoteNodeOption describe options for RemoteNode, returns from RemoteNodeProvider
func DefaultRemoteNodeOption ¶ added in v0.2.8
func DefaultRemoteNodeOption(addr string) *RemoteNodeOption
DefaultRemoteNodeOption returns default remoteNodeOption with provided address
type RemoteNodesProvider ¶ added in v0.2.8
type RemoteNodesProvider func() []*RemoteNodeOption
RemoteNodesProvider is type for function, called automatically and returns info about remote nodes
type ReplicatorClient ¶
type ReplicatorClient interface { Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) }
ReplicatorClient is the client API for Replicator service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewReplicatorClient ¶
func NewReplicatorClient(cc *grpc.ClientConn) ReplicatorClient
type ReplicatorServer ¶
type ReplicatorServer interface { Hello(context.Context, *HelloRequest) (*HelloResponse, error) Sync(context.Context, *SyncRequest) (*SyncResponse, error) }
ReplicatorServer is the server API for Replicator service.
type Rplx ¶
type Rplx struct {
// contains filtered or unexported fields
}
Rplx describe main Rplx object
func (*Rplx) All ¶ added in v0.2.4
All returns all variables values first returns param - not expires variables second param - expires, but not garbage collected variables
func (*Rplx) Delete ¶
Delete sets for variable ttl with -1 sec from Now, sends variable to replication (update TTL on clients) and remove variable from rplx.variables map
func (*Rplx) Get ¶
Get returns variable v or error if variable not exists or expired if variable expired, removes variable from rplx.variables map
func (*Rplx) Hello ¶ added in v0.2.0
func (rplx *Rplx) Hello(ctx context.Context, req *HelloRequest) (*HelloResponse, error)
Hello is implementation grpc method for get Hello request
func (*Rplx) StartReplicationServer ¶
StartReplicationServer starts grpc server for receive sync messages from remote nodes
func (*Rplx) Sync ¶
func (rplx *Rplx) Sync(ctx context.Context, req *SyncRequest) (*SyncResponse, error)
Sync is GRPC function, fired on incoming sync message
type SyncNodeValue ¶
type SyncNodeValue struct { Value int64 `protobuf:"varint,1,opt,name=Value,proto3" json:"Value,omitempty"` Version int64 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SyncNodeValue) Descriptor ¶
func (*SyncNodeValue) Descriptor() ([]byte, []int)
func (*SyncNodeValue) GetValue ¶
func (m *SyncNodeValue) GetValue() int64
func (*SyncNodeValue) GetVersion ¶ added in v0.2.0
func (m *SyncNodeValue) GetVersion() int64
func (*SyncNodeValue) ProtoMessage ¶
func (*SyncNodeValue) ProtoMessage()
func (*SyncNodeValue) Reset ¶
func (m *SyncNodeValue) Reset()
func (*SyncNodeValue) String ¶
func (m *SyncNodeValue) String() string
func (*SyncNodeValue) XXX_DiscardUnknown ¶
func (m *SyncNodeValue) XXX_DiscardUnknown()
func (*SyncNodeValue) XXX_Marshal ¶
func (m *SyncNodeValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncNodeValue) XXX_Merge ¶
func (dst *SyncNodeValue) XXX_Merge(src proto.Message)
func (*SyncNodeValue) XXX_Size ¶
func (m *SyncNodeValue) XXX_Size() int
func (*SyncNodeValue) XXX_Unmarshal ¶
func (m *SyncNodeValue) XXX_Unmarshal(b []byte) error
type SyncRequest ¶
type SyncRequest struct { NodeID string `protobuf:"bytes,1,opt,name=NodeID,proto3" json:"NodeID,omitempty"` // map key - variable name Variables map[string]*SyncVariable `` /* 159-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SyncRequest) Descriptor ¶
func (*SyncRequest) Descriptor() ([]byte, []int)
func (*SyncRequest) GetNodeID ¶
func (m *SyncRequest) GetNodeID() string
func (*SyncRequest) GetVariables ¶
func (m *SyncRequest) GetVariables() map[string]*SyncVariable
func (*SyncRequest) ProtoMessage ¶
func (*SyncRequest) ProtoMessage()
func (*SyncRequest) Reset ¶
func (m *SyncRequest) Reset()
func (*SyncRequest) String ¶
func (m *SyncRequest) String() string
func (*SyncRequest) XXX_DiscardUnknown ¶
func (m *SyncRequest) XXX_DiscardUnknown()
func (*SyncRequest) XXX_Marshal ¶
func (m *SyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncRequest) XXX_Merge ¶
func (dst *SyncRequest) XXX_Merge(src proto.Message)
func (*SyncRequest) XXX_Size ¶
func (m *SyncRequest) XXX_Size() int
func (*SyncRequest) XXX_Unmarshal ¶
func (m *SyncRequest) XXX_Unmarshal(b []byte) error
type SyncResponse ¶
type SyncResponse struct { Code int64 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SyncResponse) Descriptor ¶
func (*SyncResponse) Descriptor() ([]byte, []int)
func (*SyncResponse) GetCode ¶
func (m *SyncResponse) GetCode() int64
func (*SyncResponse) ProtoMessage ¶
func (*SyncResponse) ProtoMessage()
func (*SyncResponse) Reset ¶
func (m *SyncResponse) Reset()
func (*SyncResponse) String ¶
func (m *SyncResponse) String() string
func (*SyncResponse) XXX_DiscardUnknown ¶
func (m *SyncResponse) XXX_DiscardUnknown()
func (*SyncResponse) XXX_Marshal ¶
func (m *SyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncResponse) XXX_Merge ¶
func (dst *SyncResponse) XXX_Merge(src proto.Message)
func (*SyncResponse) XXX_Size ¶
func (m *SyncResponse) XXX_Size() int
func (*SyncResponse) XXX_Unmarshal ¶
func (m *SyncResponse) XXX_Unmarshal(b []byte) error
type SyncVariable ¶
type SyncVariable struct { // map key - nodeID NodesValues map[string]*SyncNodeValue `` /* 163-byte string literal not displayed */ TTL int64 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` TTLVersion int64 `protobuf:"varint,3,opt,name=TTLVersion,proto3" json:"TTLVersion,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SyncVariable) Descriptor ¶
func (*SyncVariable) Descriptor() ([]byte, []int)
func (*SyncVariable) GetNodesValues ¶
func (m *SyncVariable) GetNodesValues() map[string]*SyncNodeValue
func (*SyncVariable) GetTTL ¶
func (m *SyncVariable) GetTTL() int64
func (*SyncVariable) GetTTLVersion ¶ added in v0.2.0
func (m *SyncVariable) GetTTLVersion() int64
func (*SyncVariable) ProtoMessage ¶
func (*SyncVariable) ProtoMessage()
func (*SyncVariable) Reset ¶
func (m *SyncVariable) Reset()
func (*SyncVariable) String ¶
func (m *SyncVariable) String() string
func (*SyncVariable) XXX_DiscardUnknown ¶
func (m *SyncVariable) XXX_DiscardUnknown()
func (*SyncVariable) XXX_Marshal ¶
func (m *SyncVariable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SyncVariable) XXX_Merge ¶
func (dst *SyncVariable) XXX_Merge(src proto.Message)
func (*SyncVariable) XXX_Size ¶
func (m *SyncVariable) XXX_Size() int
func (*SyncVariable) XXX_Unmarshal ¶
func (m *SyncVariable) XXX_Unmarshal(b []byte) error