inmem

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package inmem implements a layer of services in memory using purely Go constructs. In theory, they can be swapped out for services implemented using other tech, e.g. databases, redis, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache added in v0.0.11

func NewCache(config CacheConfig) (*bigcache.BigCache, error)

Types

type CacheConfig added in v0.0.11

type CacheConfig struct {
	// Total capacity of cache in MB.
	Size int
	// Time-to-live for each cache entry before automatic deletion.
	TTL time.Duration
}

type ChunkProxy added in v0.0.11

type ChunkProxy struct {
	otf.Application
	logr.Logger
	// contains filtered or unexported fields
}

ChunkProxy is a caching proxy for log chunks, proxying requests to the backend.

func NewChunkProxy added in v0.0.11

func NewChunkProxy(app otf.Application, logger logr.Logger, cache otf.Cache, backend otf.ChunkStore) (*ChunkProxy, error)

func (*ChunkProxy) GetChunk added in v0.0.11

func (c *ChunkProxy) GetChunk(ctx context.Context, opts otf.GetChunkOptions) (otf.Chunk, error)

GetChunk attempts to retrieve a chunk from the cache before falling back to using the backend store.

func (*ChunkProxy) GetChunkByID added in v0.0.12

func (c *ChunkProxy) GetChunkByID(ctx context.Context, chunkID int) (otf.PersistedChunk, error)

func (*ChunkProxy) PutChunk added in v0.0.11

func (c *ChunkProxy) PutChunk(ctx context.Context, chunk otf.Chunk) (otf.PersistedChunk, error)

PutChunk writes a chunk of data to the backend store before caching it.

func (*ChunkProxy) Start added in v0.0.12

func (c *ChunkProxy) Start(ctx context.Context) error

Start the chunk proxy daemon, which keeps the cache up-to-date.

type CloudService added in v0.0.19

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

func NewCloudService added in v0.0.19

func NewCloudService(configs ...cloud.Config) (*CloudService, error)

func NewTestCloudService added in v0.0.19

func NewTestCloudService() *CloudService

func (*CloudService) GetCloudConfig added in v0.0.19

func (cs *CloudService) GetCloudConfig(name string) (cloud.Config, error)

func (*CloudService) ListCloudConfigs added in v0.0.19

func (cs *CloudService) ListCloudConfigs() []cloud.Config

type PubSub added in v0.0.12

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

PubSub implements a 'pub-sub' service using go channels.

func NewPubSub added in v0.0.12

func NewPubSub() *PubSub

func (*PubSub) Publish added in v0.0.12

func (e *PubSub) Publish(event otf.Event)

Publish relays an event to a list of subscribers

func (*PubSub) Subscribe added in v0.0.12

func (e *PubSub) Subscribe(ctx context.Context, name string) (<-chan otf.Event, error)

Subscribe subscribes the caller to a stream of events.

Jump to

Keyboard shortcuts

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