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 ¶
- func NewCache(config CacheConfig) (*bigcache.BigCache, error)
- type CacheConfig
- type ChunkProxy
- func (c *ChunkProxy) GetChunk(ctx context.Context, opts otf.GetChunkOptions) (otf.Chunk, error)
- func (c *ChunkProxy) GetChunkByID(ctx context.Context, chunkID int) (otf.PersistedChunk, error)
- func (c *ChunkProxy) PutChunk(ctx context.Context, chunk otf.Chunk) (otf.PersistedChunk, error)
- func (c *ChunkProxy) Start(ctx context.Context) error
- type Mapper
- type PubSub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheConfig ¶ added in v0.0.11
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.
type Mapper ¶ added in v0.0.12
type Mapper struct {
otf.Application
// contains filtered or unexported fields
}
Mapper is an in-memory implementation of a mapper.
A mapper maintains mappings between various resource identifiers, which are used by upstream layers to make decisions and efficiently lookup resources.
For instance, the authorization layer needs to decide whether to permit access and cannot do so based on a single identifier (e.g. a run id) but needs to know which organization and workspace id it relates to.
Whereas the persistence layer, with access to mappings, need only lookup resources based on the most appropriate identifier for which it maintains an index, rather having to support lookups using a multitude of identifiers.
func NewMapper ¶ added in v0.0.12
func NewMapper(app otf.Application) *Mapper
NewMapper constructs the mapper
func (*Mapper) LookupWorkspaceID ¶ added in v0.0.12
func (m *Mapper) LookupWorkspaceID(spec otf.WorkspaceSpec) string
LookupWorkspaceID looks up the ID corresponding to the given spec. If the spec already contains an ID then that is returned, otherwise the mapper looks up the ID corresponding to the given organization and workspace name. If the spec is invalid, then an empty string is returned.
func (*Mapper) Populate ¶ added in v0.0.12
func (m *Mapper) Populate(ctx context.Context, ws otf.WorkspaceService, rs otf.RunService) error
Populate populates the mapper with identifiers