admin

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package admin is a generated GoMock package.

Index

Constants

View Source
const (
	DefaultListenAddress      = "127.0.0.1:9090"
	DefaultReplicationFactor  = flags.DefaultReplicationFactor
	DefaultLogStreamGCTimeout = 24 * time.Hour
)
View Source
const (
	ReplicaSelectorNameRandom = "random"
	ReplicaSelectorNameLFU    = "lfu" // least frequently used
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, opts ...Option) (*Admin, error)

New creates an Admin. It should be created only once. It returns an error if cluster metadata cannot be fetched.

func (*Admin) Address

func (adm *Admin) Address() string

Address returns the bound address of the admin server.

func (*Admin) Close

func (adm *Admin) Close() (err error)

Close closes the admin. This method closes the gRPC server immediately.

func (*Admin) HandleHeartbeatTimeout

func (adm *Admin) HandleHeartbeatTimeout(ctx context.Context, snid types.StorageNodeID)

func (*Admin) HandleReport

func (adm *Admin) HandleReport(ctx context.Context, snm *snpb.StorageNodeMetadataDescriptor)

func (*Admin) Metadata deprecated

func (adm *Admin) Metadata(ctx context.Context) (*varlogpb.MetadataDescriptor, error)

Metadata returns the metadata of cluster.

Deprecated: Only integration test code calls this method, but they are not allowed call this method directly.

func (*Admin) Serve

func (adm *Admin) Serve() error

Serve accepts incoming RPC calls on the server. This method blocks calling goroutine.

type LogStreamIDGenerator

type LogStreamIDGenerator struct {
	// contains filtered or unexported fields
}

LogStreamIDGenerator generates LogStreamID.

func NewLogStreamIDGenerator

func NewLogStreamIDGenerator(ctx context.Context, cmView mrmanager.ClusterMetadataView) (*LogStreamIDGenerator, error)

NewLogStreamIDGenerator creates a LogStreamIDGenerator. Admin should create a single LogStreamIDGenerator to avoid conflict of LogStreamID.

func (*LogStreamIDGenerator) Generate

func (gen *LogStreamIDGenerator) Generate() types.LogStreamID

Generate returns a new LogStreamID. The LogStreamID generated by this method is incremented by one starting from MinLogStreamID, which is 1. Note that the result ID may already exist in the cluster, the caller can call Refresh to reflect the recent metadata, and then call this method again.

func (*LogStreamIDGenerator) Refresh

func (gen *LogStreamIDGenerator) Refresh(ctx context.Context) error

Refresh refreshes the generator. It fetches the greatest LogStreamID issued so far. If this method fails, the caller can call this again.

type MockReplicaSelector

type MockReplicaSelector struct {
	// contains filtered or unexported fields
}

MockReplicaSelector is a mock of ReplicaSelector interface.

func NewMockReplicaSelector

func NewMockReplicaSelector(ctrl *gomock.Controller) *MockReplicaSelector

NewMockReplicaSelector creates a new mock instance.

func (*MockReplicaSelector) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockReplicaSelector) Name added in v0.12.0

func (m *MockReplicaSelector) Name() string

Name mocks base method.

func (*MockReplicaSelector) Select

Select mocks base method.

type MockReplicaSelectorMockRecorder

type MockReplicaSelectorMockRecorder struct {
	// contains filtered or unexported fields
}

MockReplicaSelectorMockRecorder is the mock recorder for MockReplicaSelector.

func (*MockReplicaSelectorMockRecorder) Name added in v0.12.0

Name indicates an expected call of Name.

func (*MockReplicaSelectorMockRecorder) Select

func (mr *MockReplicaSelectorMockRecorder) Select(arg0 any) *gomock.Call

Select indicates an expected call of Select.

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAutoUnseal

func WithAutoUnseal() Option

func WithClusterID

func WithClusterID(cid types.ClusterID) Option

func WithDefaultGRPCServerOptions added in v0.21.0

func WithDefaultGRPCServerOptions(grpcServerOptions ...grpc.ServerOption) Option

func WithListenAddress

func WithListenAddress(listen string) Option

func WithLogStreamGCTimeout

func WithLogStreamGCTimeout(logStreamGCTimeout time.Duration) Option

WithLogStreamGCTimeout sets expiration duration for garbage log streams. To turn off log stream GC, a very large value can be set.

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithMetadataRepositoryManager

func WithMetadataRepositoryManager(mrMgr mrmanager.MetadataRepositoryManager) Option

func WithReplicaSelector

func WithReplicaSelector(replicaSelector ReplicaSelector) Option

func WithReplicationFactor

func WithReplicationFactor(replicationFactor int) Option

func WithStatisticsRepository

func WithStatisticsRepository(statsRepos stats.Repository) Option

func WithStorageNodeManager

func WithStorageNodeManager(snMgr snmanager.StorageNodeManager) Option

func WithStorageNodeWatcherOptions

func WithStorageNodeWatcherOptions(opts ...snwatcher.Option) Option

func WithoutAutoLogStreamSync

func WithoutAutoLogStreamSync() Option

WithoutAutoLogStreamSync disables automatic sync job between replicas in the log stream.

type ReplicaSelector

type ReplicaSelector interface {
	// Name returns the name of the replica selector, and it should be unique
	// among all replica selectors.
	Name() string
	// Select returns a slice of `varlogpb.ReplicaDescriptor`; its length
	// should equal the replication factor.
	Select(ctx context.Context) ([]*varlogpb.ReplicaDescriptor, error)
}

ReplicaSelector selects storage nodes and volumes to store data for replicas of a new log stream.

func NewReplicaSelector added in v0.13.0

func NewReplicaSelector(selector string, cmview mrmanager.ClusterMetadataView, repfactor int) (ReplicaSelector, error)

type TestMockServer added in v0.3.1

type TestMockServer struct {
	*admpb.MockClusterManagerServer
	// contains filtered or unexported fields
}

func TestNewMockServer added in v0.3.1

func TestNewMockServer(t *testing.T, ctrl *gomock.Controller) *TestMockServer

func (*TestMockServer) Address added in v0.3.1

func (tms *TestMockServer) Address() string

func (*TestMockServer) Close added in v0.3.1

func (tms *TestMockServer) Close()

func (*TestMockServer) Run added in v0.3.1

func (tms *TestMockServer) Run()

type TestServer

type TestServer struct {
	*Admin
	// contains filtered or unexported fields
}

func TestNewClusterManager

func TestNewClusterManager(t *testing.T, opts ...Option) *TestServer

func (*TestServer) Close

func (ts *TestServer) Close(t *testing.T)

func (*TestServer) Serve

func (ts *TestServer) Serve(t *testing.T)

type TopicIDGenerator

type TopicIDGenerator struct {
	// contains filtered or unexported fields
}

TopicIDGenerator generates TopicID.

func NewTopicIDGenerator

func NewTopicIDGenerator(ctx context.Context, cmView mrmanager.ClusterMetadataView) (*TopicIDGenerator, error)

NewTopicIDGenerator creates a TopicIDGenerator. Admin should create a single TopicIDGenerator to avoid conflict of TopicID.

func (*TopicIDGenerator) Generate

func (gen *TopicIDGenerator) Generate() types.TopicID

Generate returns a new TopicID. The TopicID generated by this method is incremented by one starting from MinTopicID, which is 1. Note that the result ID may already exist in the cluster, the caller can call Refresh to reflect the recent metadata, and then call this method again.

func (*TopicIDGenerator) Refresh

func (gen *TopicIDGenerator) Refresh(ctx context.Context) error

Refresh refreshes the generator. It fetches the greatest TopicID issued so far. If this method fails, the caller can call this again.

Directories

Path Synopsis
Package mrmanager is a generated GoMock package.
Package mrmanager is a generated GoMock package.
Package snmanager is a generated GoMock package.
Package snmanager is a generated GoMock package.
Package snwatcher is a generated GoMock package.
Package snwatcher is a generated GoMock package.
Package stats is a generated GoMock package.
Package stats is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL