service

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package service

Package service

Package service manages the main logic of server.

Package service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup interface {
	Start(ctx context.Context) (<-chan error, error)
	GetObject(ctx context.Context, uuid string) (*payload.Backup_Compressed_MetaVector, error)
	GetLocation(ctx context.Context, uuid string) ([]string, error)
	Register(ctx context.Context, vec *payload.Backup_Compressed_MetaVector) error
	RegisterMultiple(ctx context.Context, vecs *payload.Backup_Compressed_MetaVectors) error
	Remove(ctx context.Context, uuid string) error
	RemoveMultiple(ctx context.Context, uuids ...string) error
	RegisterIPs(ctx context.Context, uuid string, ips []string) error
	RemoveIPs(ctx context.Context, ips []string) error
}

func NewBackup

func NewBackup(opts ...BackupOption) (bu Backup, err error)

type BackupOption

type BackupOption func(b *backup) error

func WithBackupAddr

func WithBackupAddr(addr string) BackupOption

func WithBackupClient

func WithBackupClient(client grpc.Client) BackupOption

type Compressor

type Compressor interface {
	PreStart(ctx context.Context) error
	Start(ctx context.Context) (<-chan error, error)
	Compress(ctx context.Context, vector []float32) ([]byte, error)
	Decompress(ctx context.Context, bytes []byte) ([]float32, error)
	MultiCompress(ctx context.Context, vectors [][]float32) ([][]byte, error)
	MultiDecompress(ctx context.Context, bytess [][]byte) ([][]float32, error)
	Len() uint64
	TotalRequested() uint64
	TotalCompleted() uint64
}

func NewCompressor

func NewCompressor(opts ...CompressorOption) (Compressor, error)

type CompressorOption

type CompressorOption func(c *compressor) error

func WithCompressAlgorithm

func WithCompressAlgorithm(name string) CompressorOption

func WithCompressionLevel

func WithCompressionLevel(level int) CompressorOption

func WithCompressorErrGroup added in v0.0.28

func WithCompressorErrGroup(eg errgroup.Group) CompressorOption

func WithCompressorWorker added in v0.0.28

func WithCompressorWorker(opts ...worker.WorkerOption) CompressorOption

type Registerer added in v0.0.28

type Registerer interface {
	PreStart(ctx context.Context) error
	Start(ctx context.Context) (<-chan error, error)
	PostStop(ctx context.Context) error
	Register(ctx context.Context, meta *payload.Backup_MetaVector) error
	RegisterMulti(ctx context.Context, metas *payload.Backup_MetaVectors) error
	Len() uint64
	TotalRequested() uint64
	TotalCompleted() uint64
}

func NewRegisterer added in v0.0.28

func NewRegisterer(opts ...RegistererOption) (Registerer, error)

type RegistererOption added in v0.0.28

type RegistererOption func(r *registerer) error

func WithRegistererBackup added in v0.0.28

func WithRegistererBackup(b Backup) RegistererOption

func WithRegistererClient added in v0.0.28

func WithRegistererClient(c client.Client) RegistererOption

func WithRegistererCompressor added in v0.0.28

func WithRegistererCompressor(c Compressor) RegistererOption

func WithRegistererErrGroup added in v0.0.28

func WithRegistererErrGroup(eg errgroup.Group) RegistererOption

func WithRegistererWorker added in v0.0.28

func WithRegistererWorker(opts ...worker.WorkerOption) RegistererOption

Jump to

Keyboard shortcuts

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