service

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package service

Package service manages the main logic of server.

Package service

Package service

Package service

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_MetaVector, error)
	GetLocation(ctx context.Context, uuid string) ([]string, error)
	Register(ctx context.Context, vec *payload.Backup_MetaVector) error
	RegisterMultiple(ctx context.Context, vecs *payload.Backup_MetaVectors) error
	Remove(ctx context.Context, uuid string) error
	RemoveMultiple(ctx context.Context, uuids ...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 Filter

type Filter interface {
	Start(ctx context.Context) (<-chan error, error)
	FilterSearch(context.Context, *payload.Search_Response) (*payload.Search_Response, error)
}

func NewFilter

func NewFilter(opts ...FilterOption) (ef Filter, err error)

type FilterOption

type FilterOption func(f *filter) error

func WithFilterClient

func WithFilterClient(client grpc.Client) FilterOption

type GWOption

type GWOption func(g *gateway) error

func WithDiscoverer added in v0.0.9

func WithDiscoverer(c discoverer.Client) GWOption

func WithErrGroup

func WithErrGroup(eg errgroup.Group) GWOption

type Gateway

type Gateway interface {
	Start(ctx context.Context) (<-chan error, error)
	GetAgentCount(ctx context.Context) int
	Do(ctx context.Context,
		f func(ctx context.Context, tgt string, ac agent.AgentClient, copts ...grpc.CallOption) error) error
	DoMulti(ctx context.Context, num int,
		f func(ctx context.Context, tgt string, ac agent.AgentClient, copts ...grpc.CallOption) error) error
	BroadCast(ctx context.Context,
		f func(ctx context.Context, tgt string, ac agent.AgentClient, copts ...grpc.CallOption) error) error
}

func NewGateway

func NewGateway(opts ...GWOption) (gw Gateway, err error)

type Meta

type Meta interface {
	Start(ctx context.Context) (<-chan error, error)
	Exists(context.Context, string) (bool, error)
	GetMeta(context.Context, string) (string, error)
	GetMetas(context.Context, ...string) ([]string, error)
	GetUUID(context.Context, string) (string, error)
	GetUUIDs(context.Context, ...string) ([]string, error)
	SetUUIDandMeta(context.Context, string, string) error
	SetUUIDandMetas(context.Context, map[string]string) error
	DeleteMeta(context.Context, string) (string, error)
	DeleteMetas(context.Context, ...string) ([]string, error)
	DeleteUUID(context.Context, string) (string, error)
	DeleteUUIDs(context.Context, ...string) ([]string, error)
}

func NewMeta

func NewMeta(opts ...MetaOption) (mi Meta, err error)

type MetaOption

type MetaOption func(m *meta) error

func WithMetaAddr

func WithMetaAddr(addr string) MetaOption

func WithMetaCache added in v0.0.2

func WithMetaCache(c cache.Cache) MetaOption

func WithMetaCacheEnabled added in v0.0.2

func WithMetaCacheEnabled(flg bool) MetaOption

func WithMetaCacheExpireDuration added in v0.0.2

func WithMetaCacheExpireDuration(dur string) MetaOption

func WithMetaCacheExpiredCheckDuration added in v0.0.2

func WithMetaCacheExpiredCheckDuration(dur string) MetaOption

func WithMetaClient

func WithMetaClient(client grpc.Client) MetaOption

func WithMetaHostPort

func WithMetaHostPort(host string, port int) MetaOption

Jump to

Keyboard shortcuts

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