distcache

package
v2.30.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseTestDistCacheCluster

func CloseTestDistCacheCluster(t *testing.T, cl *TestDistCacheCluster)

CloseTestDistCacheCluster closes the test dist cache cluster.

func Module

func Module() fx.Option

Module provides a new DistCache FX module.

func RegisterDistCacheService

func RegisterDistCacheService(in RegisterDistCacheServiceIn) error

RegisterDistCacheService registers the handler on grpc.Server.

Types

type DistCache

type DistCache struct {
	distcachev1.UnimplementedDistCacheServiceServer
	// contains filtered or unexported fields
}

DistCache is a peer to peer distributed cache.

func NewDistCache

func NewDistCache(
	config *olricconfig.Config,
	olric *olric.Olric,
	objStorage objectstorage.ObjectStorageIface,
	metrics *DistCacheMetrics,
	shutDowner fx.Shutdowner,
	prometheusRegistry *prometheus.Registry,
) *DistCache

NewDistCache creates a new instance of DistCache.

func (*DistCache) DeleteDMap

func (dc *DistCache) DeleteDMap(name string) error

DeleteDMap deletes a DMap.

func (*DistCache) GetStats

func (dc *DistCache) GetStats(ctx context.Context, _ *emptypb.Empty) (*structpb.Struct, error)

GetStats returns stats of the current Olric member.

func (*DistCache) NewDMap

func (dc *DistCache) NewDMap(name string, config olricconfig.DMap, persistent bool) (olric.DMap, error)

NewDMap creates a new DMap.

type DistCacheConstructor

type DistCacheConstructor struct {
	ConfigKey     string
	DefaultConfig dcconfig.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 distributed cache. It also hooks in the service discovery plugin.

type DistCacheConstructorIn

type DistCacheConstructorIn struct {
	fx.In
	PeerDiscovery      *peers.PeerDiscovery
	PrometheusRegistry *prometheus.Registry
	LivenessMultiJob   *jobs.MultiJob `name:"liveness.service"`
	Unmarshaller       config.Unmarshaller
	Lifecycle          fx.Lifecycle
	Shutdowner         fx.Shutdowner
	ObjectStorage      objectstorage.ObjectStorageIface `optional:"true"`
	Logger             *log.Logger
}

DistCacheConstructorIn holds parameters of ProvideDistCache.

type DistCacheMetrics

type DistCacheMetrics struct {
	EntriesTotal                 *prometheus.GaugeVec
	DeleteHits                   *prometheus.GaugeVec
	DeleteMisses                 *prometheus.GaugeVec
	GetMisses                    *prometheus.GaugeVec
	GetHits                      *prometheus.GaugeVec
	EvictedTotal                 *prometheus.GaugeVec
	PartitionsCount              *prometheus.GaugeVec
	BackupPartitionsCount        *prometheus.GaugeVec
	FragmentMigrationEventsTotal *prometheus.CounterVec
	FragmentReceivedEventsTotal  *prometheus.CounterVec
	PartitionsLength             *prometheus.GaugeVec
	BackupPartitionsLength       *prometheus.GaugeVec
}

DistCacheMetrics holds metrics from DistCache, Olric, DMap statistics.

type OlricLogWriter

type OlricLogWriter struct {
	Logger *log.Logger
}

OlricLogWriter is wrapper around aperture Logger that parse the message before writing to olricConfig.LogOutput.

func (*OlricLogWriter) Write

func (ol *OlricLogWriter) Write(message []byte) (int, error)

Write writes the message and logs in aperture Logger format.

type RegisterDistCacheServiceIn added in v2.16.0

type RegisterDistCacheServiceIn struct {
	fx.In
	Handler   *DistCache
	Server    *grpc.Server `name:"default"`
	HealthSrv *health.Server
}

RegisterDistCacheServiceIn bundles and annotates parameters.

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 *stdlog.Logger)

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

type TestDistCacheCluster

type TestDistCacheCluster struct {
	Lock    sync.Mutex
	Members map[string]*DistCache
}

TestDistCacheCluster is a test cluster of DistCache instances.

func NewTestDistCacheCluster

func NewTestDistCacheCluster(t *testing.T, n int) *TestDistCacheCluster

NewTestDistCacheCluster creates a new DistCache cluster with n members.

Directories

Path Synopsis
+kubebuilder:validation:Optional
+kubebuilder:validation:Optional

Jump to

Keyboard shortcuts

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