autoid

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockForTest

func MockForTest(store kv.Storage) *mockClient

MockForTest is used for testing, the UT test and unistore use this.

Types

type Service

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

Service implement the grpc AutoIDAlloc service, defined in kvproto/pkg/autoid.

func New

func New(selfAddr string, etcdAddr []string, store kv.Storage, tlsConfig *tls.Config) *Service

New return a Service instance.

func (*Service) AllocAutoID

func (s *Service) AllocAutoID(ctx context.Context, req *autoid.AutoIDRequest) (*autoid.AutoIDResponse, error)

AllocAutoID implements gRPC AutoIDAlloc interface.

func (*Service) Close

func (s *Service) Close()

Close closes the Service and clean up resource.

func (*Service) Rebase

Rebase implements gRPC AutoIDAlloc interface. req.N = 0 is handled specially, it is used to return the current auto ID value.

Jump to

Keyboard shortcuts

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