client

package
v0.0.0-...-e65b650 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSugaredZapLogger

func GetSugaredZapLogger(logFile string, errFile string, verbose bool) *zap.SugaredLogger

Set up logger at the specified verbosity level

func LoadTLSCredentials

func LoadTLSCredentials(certDir string) (credentials.TransportCredentials, error)

Utility function to set up mTLS config and credentials

func NewCacheClient

func NewCacheClient(cert_dir string, server_host string, server_port int, enableHTTPS bool) (pb.CacheServiceClient, error)

Utility funciton to get a new Cache Client which uses gRPC secured with mTLS

Types

type ClientWrapper

type ClientWrapper struct {
	Config  nodelib.NodesConfig
	Ring    *ring.Ring
	Logger  *zap.SugaredLogger
	CertDir string
}

Client wrapper for interacting with Identity Server

func NewClientWrapper

func NewClientWrapper(certDir string, configFile string, insecure bool, verbose bool) *ClientWrapper

Create new Client struct instance and sets up node ring with consistent hashing

func (*ClientWrapper) Get

func (c *ClientWrapper) Get(key string) (string, error)

Get item from cache. Hash the key to find which node has the value stored.

func (*ClientWrapper) GetGrpc

func (c *ClientWrapper) GetGrpc(key string) (string, error)

func (*ClientWrapper) Put

func (c *ClientWrapper) Put(key string, value string) error

Put key-value pair into cache. Hash the key to find which node to store it in.

func (*ClientWrapper) PutGrpc

func (c *ClientWrapper) PutGrpc(key string, value string) error

func (*ClientWrapper) StartClusterConfigWatcher

func (c *ClientWrapper) StartClusterConfigWatcher(shutdownChan <-chan bool)

Checks cluster config every 5 seconds and updates ring with any changes. Runs in infinite loop.

type Payload

type Payload struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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