Documentation ¶
Overview ¶
Package client is a generated GoMock package.
Index ¶
- Variables
- type Kind
- type LogClient
- func (c *LogClient) Append(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, data [][]byte) ([]snpb.AppendResult, error)
- func (c *LogClient) AppendStream(ctx context.Context) (snpb.LogIO_AppendClient, error)
- func (c *LogClient) LogStreamReplicaMetadata(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID) (snpb.LogStreamReplicaMetadataDescriptor, error)
- func (c *LogClient) Subscribe(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, ...) (<-chan SubscribeResult, error)
- func (c *LogClient) SubscribeTo(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, ...) (<-chan SubscribeResult, error)
- func (c *LogClient) Target() varlogpb.StorageNode
- func (c *LogClient) TrimDeprecated(ctx context.Context, tpid types.TopicID, glsn types.GLSN) error
- type ManagementClient
- func (c *ManagementClient) AddLogStreamReplica(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, snpath string) (snpb.LogStreamReplicaMetadataDescriptor, error)
- func (c *ManagementClient) Close() error
- func (c *ManagementClient) GetMetadata(ctx context.Context) (*snpb.StorageNodeMetadataDescriptor, error)
- func (c *ManagementClient) RemoveLogStream(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID) error
- func (c *ManagementClient) Seal(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, ...) (varlogpb.LogStreamStatus, types.GLSN, error)
- func (c *ManagementClient) Sync(ctx context.Context, tpid types.TopicID, logStreamID types.LogStreamID, ...) (*snpb.SyncStatus, error)
- func (c *ManagementClient) Target() varlogpb.StorageNode
- func (c *ManagementClient) Trim(ctx context.Context, topicID types.TopicID, lastGLSN types.GLSN) (map[types.LogStreamID]error, error)
- func (c *ManagementClient) Unseal(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, ...) error
- type Manager
- func (mgr *Manager[T]) Close() (err error)
- func (mgr *Manager[T]) CloseClient(snid types.StorageNodeID) error
- func (mgr *Manager[T]) Get(snid types.StorageNodeID) (T, error)
- func (mgr *Manager[T]) GetByAddress(addr string) (T, error)
- func (mgr *Manager[T]) GetOrConnect(ctx context.Context, snid types.StorageNodeID, addr string) (T, error)
- type ManagerOption
- type MockStorageNodeManagementClient
- func (m *MockStorageNodeManagementClient) AddLogStreamReplica(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, arg3 string) (snpb.LogStreamReplicaMetadataDescriptor, error)
- func (m *MockStorageNodeManagementClient) Close() error
- func (m *MockStorageNodeManagementClient) EXPECT() *MockStorageNodeManagementClientMockRecorder
- func (m *MockStorageNodeManagementClient) GetMetadata(arg0 context.Context) (*snpb.StorageNodeMetadataDescriptor, error)
- func (m *MockStorageNodeManagementClient) RemoveLogStream(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID) error
- func (m *MockStorageNodeManagementClient) Seal(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, ...) (varlogpb.LogStreamStatus, types.GLSN, error)
- func (m *MockStorageNodeManagementClient) Sync(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, ...) (*snpb.SyncStatus, error)
- func (m *MockStorageNodeManagementClient) Target() varlogpb.StorageNode
- func (m *MockStorageNodeManagementClient) Trim(arg0 context.Context, arg1 types.TopicID, arg2 types.GLSN) (map[types.LogStreamID]error, error)
- func (m *MockStorageNodeManagementClient) Unseal(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, ...) error
- type MockStorageNodeManagementClientMockRecorder
- func (mr *MockStorageNodeManagementClientMockRecorder) AddLogStreamReplica(arg0, arg1, arg2, arg3 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Close() *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) GetMetadata(arg0 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) RemoveLogStream(arg0, arg1, arg2 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Seal(arg0, arg1, arg2, arg3 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Sync(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Target() *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Trim(arg0, arg1, arg2 any) *gomock.Call
- func (mr *MockStorageNodeManagementClientMockRecorder) Unseal(arg0, arg1, arg2, arg3 any) *gomock.Call
- type StorageNodeManagementClient
- type SubscribeResult
Constants ¶
This section is empty.
Variables ¶
var InvalidSubscribeResult = SubscribeResult{ LogEntry: varlogpb.InvalidLogEntry(), Error: errors.New("invalid subscribe result"), }
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind interface { *LogClient | *ManagementClient // Target returns target storage node. Target() varlogpb.StorageNode // contains filtered or unexported methods }
Kind is a generic type for clients managed by the Manager.
type LogClient ¶
type LogClient struct {
// contains filtered or unexported fields
}
func TestNewLogClient ¶ added in v0.14.0
func TestNewLogClient(t *testing.T, rpcClient snpb.LogIOClient, target varlogpb.StorageNode) *LogClient
func (*LogClient) Append ¶
func (c *LogClient) Append(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, data [][]byte) ([]snpb.AppendResult, error)
Append stores data to the log stream specified with the topicID and the logStreamID. The backup indicates the storage nodes that have backup replicas of that log stream. It returns valid GLSN if the append completes successfully.
func (*LogClient) AppendStream ¶ added in v0.14.0
func (*LogClient) LogStreamReplicaMetadata ¶ added in v0.4.1
func (c *LogClient) LogStreamReplicaMetadata(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID) (snpb.LogStreamReplicaMetadataDescriptor, error)
func (*LogClient) Subscribe ¶
func (c *LogClient) Subscribe(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, begin, end types.GLSN) (<-chan SubscribeResult, error)
Subscribe gets log entries continuously from the storage node. It guarantees that LLSNs of log entries taken are sequential.
func (*LogClient) SubscribeTo ¶
func (*LogClient) Target ¶
func (c *LogClient) Target() varlogpb.StorageNode
Target returns connected storage node.
type ManagementClient ¶
type ManagementClient struct {
// contains filtered or unexported fields
}
func (*ManagementClient) AddLogStreamReplica ¶
func (c *ManagementClient) AddLogStreamReplica(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, snpath string) (snpb.LogStreamReplicaMetadataDescriptor, error)
func (*ManagementClient) Close ¶
func (c *ManagementClient) Close() error
Close closes connection to the storage node. Deprecated: Use `Manager[*ManagementClient]`.
func (*ManagementClient) GetMetadata ¶
func (c *ManagementClient) GetMetadata(ctx context.Context) (*snpb.StorageNodeMetadataDescriptor, error)
func (*ManagementClient) RemoveLogStream ¶
func (c *ManagementClient) RemoveLogStream(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID) error
func (*ManagementClient) Seal ¶
func (c *ManagementClient) Seal(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, lastCommittedGLSN types.GLSN) (varlogpb.LogStreamStatus, types.GLSN, error)
func (*ManagementClient) Sync ¶
func (c *ManagementClient) Sync(ctx context.Context, tpid types.TopicID, logStreamID types.LogStreamID, backupStorageNodeID types.StorageNodeID, backupAddress string, lastGLSN types.GLSN) (*snpb.SyncStatus, error)
func (*ManagementClient) Target ¶
func (c *ManagementClient) Target() varlogpb.StorageNode
func (*ManagementClient) Unseal ¶
func (c *ManagementClient) Unseal(ctx context.Context, tpid types.TopicID, lsid types.LogStreamID, replicas []varlogpb.LogStreamReplica) error
type Manager ¶
type Manager[T Kind] struct { // contains filtered or unexported fields }
Manager manages clients typed Kind.
func NewManager ¶
func NewManager[T Kind](opts ...ManagerOption) (*Manager[T], error)
NewManager creates a Manager.
func (*Manager[T]) CloseClient ¶
func (mgr *Manager[T]) CloseClient(snid types.StorageNodeID) error
CloseClient closes a client identified by the argument snid.
func (*Manager[T]) Get ¶
func (mgr *Manager[T]) Get(snid types.StorageNodeID) (T, error)
Get returns the client identified by the argument snid. It returns an error if the client does not exist.
func (*Manager[T]) GetByAddress ¶
func (*Manager[T]) GetOrConnect ¶
func (mgr *Manager[T]) GetOrConnect(ctx context.Context, snid types.StorageNodeID, addr string) (T, error)
GetOrConnect returns the client identified by the argument snid. It tries to connect the server using the argument addr if the client does not exist. It returns an error if the existing client has an address other than the argument addr or trial of the connection fails.
type ManagerOption ¶
type ManagerOption interface {
// contains filtered or unexported methods
}
func WithClusterID ¶
func WithClusterID(cid types.ClusterID) ManagerOption
func WithDefaultGRPCDialOptions ¶
func WithDefaultGRPCDialOptions(defaultGRPCDialOptions ...grpc.DialOption) ManagerOption
func WithLogger ¶
func WithLogger(logger *zap.Logger) ManagerOption
type MockStorageNodeManagementClient ¶
type MockStorageNodeManagementClient struct {
// contains filtered or unexported fields
}
MockStorageNodeManagementClient is a mock of StorageNodeManagementClient interface.
func NewMockStorageNodeManagementClient ¶
func NewMockStorageNodeManagementClient(ctrl *gomock.Controller) *MockStorageNodeManagementClient
NewMockStorageNodeManagementClient creates a new mock instance.
func (*MockStorageNodeManagementClient) AddLogStreamReplica ¶
func (m *MockStorageNodeManagementClient) AddLogStreamReplica(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, arg3 string) (snpb.LogStreamReplicaMetadataDescriptor, error)
AddLogStreamReplica mocks base method.
func (*MockStorageNodeManagementClient) Close ¶
func (m *MockStorageNodeManagementClient) Close() error
Close mocks base method.
func (*MockStorageNodeManagementClient) EXPECT ¶
func (m *MockStorageNodeManagementClient) EXPECT() *MockStorageNodeManagementClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStorageNodeManagementClient) GetMetadata ¶
func (m *MockStorageNodeManagementClient) GetMetadata(arg0 context.Context) (*snpb.StorageNodeMetadataDescriptor, error)
GetMetadata mocks base method.
func (*MockStorageNodeManagementClient) RemoveLogStream ¶
func (m *MockStorageNodeManagementClient) RemoveLogStream(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID) error
RemoveLogStream mocks base method.
func (*MockStorageNodeManagementClient) Seal ¶
func (m *MockStorageNodeManagementClient) Seal(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, arg3 types.GLSN) (varlogpb.LogStreamStatus, types.GLSN, error)
Seal mocks base method.
func (*MockStorageNodeManagementClient) Sync ¶
func (m *MockStorageNodeManagementClient) Sync(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, arg3 types.StorageNodeID, arg4 string, arg5 types.GLSN) (*snpb.SyncStatus, error)
Sync mocks base method.
func (*MockStorageNodeManagementClient) Target ¶
func (m *MockStorageNodeManagementClient) Target() varlogpb.StorageNode
Target mocks base method.
func (*MockStorageNodeManagementClient) Trim ¶
func (m *MockStorageNodeManagementClient) Trim(arg0 context.Context, arg1 types.TopicID, arg2 types.GLSN) (map[types.LogStreamID]error, error)
Trim mocks base method.
func (*MockStorageNodeManagementClient) Unseal ¶
func (m *MockStorageNodeManagementClient) Unseal(arg0 context.Context, arg1 types.TopicID, arg2 types.LogStreamID, arg3 []varlogpb.LogStreamReplica) error
Unseal mocks base method.
type MockStorageNodeManagementClientMockRecorder ¶
type MockStorageNodeManagementClientMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageNodeManagementClientMockRecorder is the mock recorder for MockStorageNodeManagementClient.
func (*MockStorageNodeManagementClientMockRecorder) AddLogStreamReplica ¶
func (mr *MockStorageNodeManagementClientMockRecorder) AddLogStreamReplica(arg0, arg1, arg2, arg3 any) *gomock.Call
AddLogStreamReplica indicates an expected call of AddLogStreamReplica.
func (*MockStorageNodeManagementClientMockRecorder) Close ¶
func (mr *MockStorageNodeManagementClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockStorageNodeManagementClientMockRecorder) GetMetadata ¶
func (mr *MockStorageNodeManagementClientMockRecorder) GetMetadata(arg0 any) *gomock.Call
GetMetadata indicates an expected call of GetMetadata.
func (*MockStorageNodeManagementClientMockRecorder) RemoveLogStream ¶
func (mr *MockStorageNodeManagementClientMockRecorder) RemoveLogStream(arg0, arg1, arg2 any) *gomock.Call
RemoveLogStream indicates an expected call of RemoveLogStream.
func (*MockStorageNodeManagementClientMockRecorder) Seal ¶
func (mr *MockStorageNodeManagementClientMockRecorder) Seal(arg0, arg1, arg2, arg3 any) *gomock.Call
Seal indicates an expected call of Seal.
func (*MockStorageNodeManagementClientMockRecorder) Sync ¶
func (mr *MockStorageNodeManagementClientMockRecorder) Sync(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call
Sync indicates an expected call of Sync.
func (*MockStorageNodeManagementClientMockRecorder) Target ¶
func (mr *MockStorageNodeManagementClientMockRecorder) Target() *gomock.Call
Target indicates an expected call of Target.
type StorageNodeManagementClient ¶
type StorageNodeManagementClient interface { Target() varlogpb.StorageNode GetMetadata(ctx context.Context) (*snpb.StorageNodeMetadataDescriptor, error) AddLogStreamReplica(ctx context.Context, topicID types.TopicID, logStreamID types.LogStreamID, snpath string) (snpb.LogStreamReplicaMetadataDescriptor, error) RemoveLogStream(ctx context.Context, topicID types.TopicID, logStreamID types.LogStreamID) error Seal(ctx context.Context, topicID types.TopicID, logStreamID types.LogStreamID, lastCommittedGLSN types.GLSN) (varlogpb.LogStreamStatus, types.GLSN, error) Unseal(ctx context.Context, topicID types.TopicID, logStreamID types.LogStreamID, replicas []varlogpb.LogStreamReplica) error Sync(ctx context.Context, topicID types.TopicID, logStreamID types.LogStreamID, backupStorageNodeID types.StorageNodeID, backupAddress string, lastGLSN types.GLSN) (*snpb.SyncStatus, error) Trim(ctx context.Context, topicID types.TopicID, lastGLSN types.GLSN) (map[types.LogStreamID]error, error) Close() error }