luci: go.chromium.org/luci/logdog/common/storage/memory Index | Files

package memory

import "go.chromium.org/luci/logdog/common/storage/memory"

Package memory implements in-memory Storage structures.

It is designed for testing, and hasn't been optimized for any productio use.

Index

Package Files

cache.go memory.go

type Cache Uses

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

Cache is an in-memory storage.Cache implementation.

func (*Cache) Get Uses

func (c *Cache) Get(ctx context.Context, key storage.CacheKey) ([]byte, bool)

Get implements storage.Cache.

func (*Cache) Put Uses

func (c *Cache) Put(ctx context.Context, key storage.CacheKey, val []byte, exp time.Duration)

Put implements storage.Cache.

type Storage Uses

type Storage struct {
    // MaxGetCount, if not zero, is the maximum number of records to retrieve from
    // a single Get request.
    MaxGetCount int

    // MaxLogAge is the configured maximum log age.
    MaxLogAge time.Duration
    // contains filtered or unexported fields
}

Storage is an implementation of the storage.Storage interface that stores data in memory.

This is intended for testing, and not intended to be performant.

func (*Storage) Close Uses

func (s *Storage) Close()

Close implements storage.Storage.

func (*Storage) Config Uses

func (s *Storage) Config(c context.Context, cfg storage.Config) error

Config implements storage.Storage.

func (*Storage) Count Uses

func (s *Storage) Count(project types.ProjectName, path types.StreamPath) (c int)

Count returns the number of log records for the given stream.

func (*Storage) Get Uses

func (s *Storage) Get(c context.Context, req storage.GetRequest, cb storage.GetCallback) error

Get implements storage.Storage.

func (*Storage) Put Uses

func (s *Storage) Put(c context.Context, req storage.PutRequest) error

Put implements storage.Storage.

func (*Storage) PutEntries Uses

func (s *Storage) PutEntries(ctx context.Context, project types.ProjectName, path types.StreamPath, entries ...*logpb.LogEntry)

PutEntries is a convenience method for ingesting logpb.Entry's into this Storage object.

func (*Storage) ResetClose Uses

func (s *Storage) ResetClose()

ResetClose resets the storage instance, allowing it to be used another time. The data stored in this instance is not changed.

func (*Storage) SetErr Uses

func (s *Storage) SetErr(err error)

SetErr sets the storage's error value. If not nil, all operations will fail with this error.

func (*Storage) Tail Uses

func (s *Storage) Tail(c context.Context, project types.ProjectName, path types.StreamPath) (*storage.Entry, error)

Tail implements storage.Storage.

Package memory imports 8 packages (graph) and is imported by 4 packages. Updated 2018-12-18. Refresh now. Tools for package owners.