service

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package service

Package service

Package service manages the main logic of server.

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
	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)
}

func NewCompressor

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

type CompressorOption

type CompressorOption func(c *compressor) error

func WithBuffer

func WithBuffer(b int) CompressorOption

func WithCompressAlgorithm

func WithCompressAlgorithm(name string) CompressorOption

func WithCompressionLevel

func WithCompressionLevel(level int) CompressorOption

func WithErrGroup

func WithErrGroup(eg errgroup.Group) CompressorOption

func WithLimitation

func WithLimitation(limit int) CompressorOption

Jump to

Keyboard shortcuts

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