store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryStore

type EntryStore interface {
	Len() int
	Get(index int) log.Entry
	GetRange(start, end int) []log.Entry
}

EntryStore is the interface for accessing log entries.

type MemoryStore

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

MemoryStore is a simple in-memory implementation of EntryStore.

func NewMemoryStore

func NewMemoryStore(format log.Format) *MemoryStore

NewMemoryStore creates a new in-memory store with the given format.

func (*MemoryStore) Append

func (m *MemoryStore) Append(entry log.Entry)

Append adds a pre-parsed entry to the store.

func (*MemoryStore) AppendRaw

func (m *MemoryStore) AppendRaw(line string) log.Entry

AppendRaw parses a raw line and appends it to the store.

func (*MemoryStore) Get

func (m *MemoryStore) Get(index int) log.Entry

func (*MemoryStore) GetRange

func (m *MemoryStore) GetRange(start, end int) []log.Entry

func (*MemoryStore) Len

func (m *MemoryStore) Len() int

type Store

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

Store provides disk-backed access to log entries with an LRU cache.

func New

func New(filepath string, cacheSize int, format log.Format) (*Store, error)

New creates a new disk-backed store from a file. It scans the file to build the line offset index.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying file.

func (*Store) Get

func (s *Store) Get(index int) log.Entry

Get retrieves the entry at the given index. Uses cache if available, otherwise reads from disk.

func (*Store) GetRange

func (s *Store) GetRange(start, end int) []log.Entry

GetRange retrieves entries in the given range [start, end).

func (*Store) Len

func (s *Store) Len() int

Len returns the number of lines in the store.

func (*Store) Refresh

func (s *Store) Refresh() (int, error)

Refresh rescans the file for new content. Returns the number of new lines found.

Jump to

Keyboard shortcuts

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