Documentation ¶
Overview ¶
Package memory implements in-memory Storage structures.
It is designed for testing, and hasn't been optimized for any productio use.
Index ¶
- type Cache
- type Storage
- func (s *Storage) Close()
- func (s *Storage) Config(c context.Context, cfg storage.Config) error
- func (s *Storage) Count(project types.ProjectName, path types.StreamPath) (c int)
- func (s *Storage) Get(c context.Context, req storage.GetRequest, cb storage.GetCallback) error
- func (s *Storage) Put(c context.Context, req storage.PutRequest) error
- func (s *Storage) PutEntries(ctx context.Context, project types.ProjectName, path types.StreamPath, ...)
- func (s *Storage) ResetClose()
- func (s *Storage) SetErr(err error)
- func (s *Storage) Tail(c context.Context, project types.ProjectName, path types.StreamPath) (*storage.Entry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an in-memory storage.Cache implementation.
type Storage ¶
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) Count ¶
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 ¶
func (s *Storage) Get(c context.Context, req storage.GetRequest, cb storage.GetCallback) error
Get implements storage.Storage.
func (*Storage) PutEntries ¶
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 ¶
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.