distcache

package
v0.1.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module provides a new DistCache FX module.

Types

type DistCache

type DistCache struct {
	sync.Mutex
	Config *olricconfig.Config
	Olric  *olric.Olric
}

DistCache wraps an Olric instance along with its config for further reference.

func (*DistCache) AddDMapCustomConfig

func (dc *DistCache) AddDMapCustomConfig(name string, dmapConfig olricconfig.DMap)

AddDMapCustomConfig adds a named DMap config into DistCache's config. If a custom config with the name does not exist, it is added. If it already exists, it is overwritten.

func (*DistCache) RemoveDMapCustomConfig

func (dc *DistCache) RemoveDMapCustomConfig(name string)

RemoveDMapCustomConfig removes a named DMap config from DistCache's config.

type DistCacheConfig

type DistCacheConfig struct {
	// BindAddr denotes the address that Olric will bind to for communication with other Olric nodes.
	BindAddr string `json:"bind_addr" default:":3320" validate:"hostname_port"`
	// ReplicaCount is 1 by default.
	ReplicaCount int `json:"replica_count" default:"1"`
	// Address to bind mememberlist server to.
	MemberlistConfigBindAddr string `json:"memberlist_config_bind_addr" default:":3322" validate:"hostname_port"`
	// Address of memberlist to advertise to other cluster members. Used for nat traversal if provided.
	MemberlistConfigAdvertiseAddr string `json:"memberlist_config_advertise_addr" validate:"omitempty,hostname_port"`
}

DistCacheConfig configures distributed cache that holds per-label counters in distributed rate limiters. swagger:model

type DistCacheConstructor

type DistCacheConstructor struct {
	Key           string
	DefaultConfig DistCacheConfig
}

DistCacheConstructor holds fields to create an instance of *DistCache.

func (DistCacheConstructor) ProvideDistCache

func (constructor DistCacheConstructor) ProvideDistCache(in DistCacheConstructorIn) (*DistCache, error)

ProvideDistCache creates a new instance of Olric distributed cache in embded mode. It also hooks in the service discovery plugin.

type DistCacheConstructorIn

type DistCacheConstructorIn struct {
	fx.In
	PeerDiscovery *peers.PeerDiscovery
	Unmarshaller  config.Unmarshaller
	Lifecycle     fx.Lifecycle
	Shutdowner    fx.Shutdowner
}

DistCacheConstructorIn holds parameters of ProvideDistCache.

type ServiceDiscovery

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

ServiceDiscovery holds fields needed to implement Olric's Service Discovery interface.

func (*ServiceDiscovery) Close

func (s *ServiceDiscovery) Close() error

Close stops underlying goroutines, if there is any. It should be a blocking call. This method is not implemented.

func (*ServiceDiscovery) Deregister

func (s *ServiceDiscovery) Deregister() error

Deregister removes this node from a service discovery directory. This method is not implemented.

func (*ServiceDiscovery) DiscoverPeers

func (s *ServiceDiscovery) DiscoverPeers() ([]string, error)

DiscoverPeers returns a list of known Olric nodes.

func (*ServiceDiscovery) Initialize

func (s *ServiceDiscovery) Initialize() error

Initialize initializes the plugin: registers some internal data structures, clients etc. This method is not implemented.

func (*ServiceDiscovery) Register

func (s *ServiceDiscovery) Register() error

Register registers this node to a service discovery directory. This method is not implemented.

func (*ServiceDiscovery) SetConfig

func (s *ServiceDiscovery) SetConfig(cfg map[string]interface{}) error

SetConfig registers plugin configuration. This method is not implemented.

func (*ServiceDiscovery) SetLogger

func (s *ServiceDiscovery) SetLogger(l *log.Logger)

SetLogger sets an appropriate logger. This method is not implemented.

Jump to

Keyboard shortcuts

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