logstream

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package logstream provides functionality for saving and retrieving logs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogEvent

type LogEvent struct {
	Size      int
	Completed bool
}

LogEvent represents a log stream event

type Manager

type Manager interface {
	WriteLogs(ctx context.Context, logStreamID string, startOffset int, buffer []byte) (*models.LogStream, error)
	ReadLogs(ctx context.Context, logStreamID string, startOffset int, limit int) ([]byte, error)
	Subscribe(ctx context.Context, options *SubscriptionOptions) (<-chan *LogEvent, error)
}

Manager interface encapsulates the logic for saving and retrieving logs

func New

func New(store Store, dbClient *db.Client, eventManager *events.EventManager, logger logger.Logger) Manager

New creates an instance of the Manager interface

type MockManager

type MockManager struct {
	mock.Mock
}

MockManager is an autogenerated mock type for the Manager type

func NewMockManager

func NewMockManager(t mockConstructorTestingTNewMockManager) *MockManager

NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockManager) ReadLogs

func (_m *MockManager) ReadLogs(ctx context.Context, logStreamID string, startOffset int, limit int) ([]byte, error)

ReadLogs provides a mock function with given fields: ctx, logStreamID, startOffset, limit

func (*MockManager) Subscribe

func (_m *MockManager) Subscribe(ctx context.Context, options *SubscriptionOptions) (<-chan *LogEvent, error)

Subscribe provides a mock function with given fields: ctx, options

func (*MockManager) WriteLogs

func (_m *MockManager) WriteLogs(ctx context.Context, logStreamID string, startOffset int, buffer []byte) (*models.LogStream, error)

WriteLogs provides a mock function with given fields: ctx, logStreamID, startOffset, buffer

type MockStore

type MockStore struct {
	mock.Mock
}

MockStore is an autogenerated mock type for the Store type

func NewMockStore

func NewMockStore(t mockConstructorTestingTNewMockStore) *MockStore

NewMockStore creates a new instance of MockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockStore) ReadLogs

func (_m *MockStore) ReadLogs(ctx context.Context, logStreamID string, startOffset int, limit int) ([]byte, error)

ReadLogs provides a mock function with given fields: ctx, logStreamID, startOffset, limit

func (*MockStore) WriteLogs

func (_m *MockStore) WriteLogs(ctx context.Context, logStreamID string, startOffset int, buffer []byte) error

WriteLogs provides a mock function with given fields: ctx, logStreamID, startOffset, buffer

type Store

type Store interface {
	WriteLogs(ctx context.Context, logStreamID string, startOffset int, buffer []byte) error
	ReadLogs(ctx context.Context, logStreamID string, startOffset int, limit int) ([]byte, error)
}

Store interface encapsulates the logic for saving and retrieving logs

func NewLogStore

func NewLogStore(objectStore objectstore.ObjectStore, dbClient *db.Client) Store

NewLogStore creates an instance of the LogStore interface

type SubscriptionOptions

type SubscriptionOptions struct {
	LastSeenLogSize *int
	LogStreamID     string
}

SubscriptionOptions includes options for setting up a log event subscription

Jump to

Keyboard shortcuts

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