aggregation

package
v0.0.0-...-6b385f4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(container *dig.Container) error

Types

type CheckPointerDeps

type CheckPointerDeps struct {
	dig.In

	RootLogger *slog.Logger

	// package private components
	CheckPointerModel checkPointerModel
}

type CheckPointerModelDeps

type CheckPointerModelDeps struct {
	dig.In

	// services
	blobstorage.Storage
}

type Commands

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

func NewCommands

func NewCommands(deps CommandsDeps) *Commands

func (*Commands) CreateCheckPoint

func (c *Commands) CreateCheckPoint(ctx context.Context) error

func (*Commands) StartAggregator

func (c *Commands) StartAggregator(ctx context.Context) error

type CommandsDeps

type CommandsDeps struct {
	dig.In

	RootLogger *slog.Logger

	// service layer
	ItemEventsReader itemEventsKafkaReader

	// package private components
	ItemEventsAggregator itemEventsAggregator
	CheckPointer         checkPointer
	CountersFactory      countersFactory
	TopKItemsFactory     topKItemsFactory
	AggregationState     aggregationState
}

type GetTopKItemsParams

type GetTopKItemsParams struct {
	Limit int
}

type GetTopKItemsResponse

type GetTopKItemsResponse struct {
	Data []TopKItem `json:"data"`
}

type ItemEventsAggregatorDeps

type ItemEventsAggregatorDeps struct {
	dig.In

	RootLogger *slog.Logger

	// config
	FlushInterval    time.Duration `name:"config.aggregator.flushInterval"`
	Verbose          bool          `name:"config.aggregator.verbose"`
	ItemEventLogRate int64         `name:"config.aggregator.itemEventLogRate"`

	// service layer
	TickerFactory func(d time.Duration) *time.Ticker

	// package private components
	AggregatorModel itemEventsAggregatorModel
}

type ItemEventsAggregatorModelDeps

type ItemEventsAggregatorModelDeps struct {
	dig.In

	RootLogger *slog.Logger

	// config
	Verbose bool `name:"config.aggregator.verbose"`

	// service layer
	ItemEventsReader itemEventsKafkaReader
}

type MockCommands

type MockCommands struct {
	mock.Mock
}

MockCommands is an autogenerated mock type for the mockCommands type

func NewMockCommands

func NewMockCommands(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCommands

NewMockCommands creates a new instance of MockCommands. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCommands) CreateCheckPoint

func (_m *MockCommands) CreateCheckPoint(ctx context.Context) error

CreateCheckPoint provides a mock function with given fields: ctx

func (*MockCommands) EXPECT

func (_m *MockCommands) EXPECT() *MockCommands_Expecter

func (*MockCommands) StartAggregator

func (_m *MockCommands) StartAggregator(ctx context.Context) error

StartAggregator provides a mock function with given fields: ctx

type MockCommands_CreateCheckPoint_Call

type MockCommands_CreateCheckPoint_Call struct {
	*mock.Call
}

MockCommands_CreateCheckPoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCheckPoint'

func (*MockCommands_CreateCheckPoint_Call) Return

func (*MockCommands_CreateCheckPoint_Call) Run

func (*MockCommands_CreateCheckPoint_Call) RunAndReturn

type MockCommands_Expecter

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

func (*MockCommands_Expecter) CreateCheckPoint

func (_e *MockCommands_Expecter) CreateCheckPoint(ctx interface{}) *MockCommands_CreateCheckPoint_Call

CreateCheckPoint is a helper method to define mock.On call

  • ctx context.Context

func (*MockCommands_Expecter) StartAggregator

func (_e *MockCommands_Expecter) StartAggregator(ctx interface{}) *MockCommands_StartAggregator_Call

StartAggregator is a helper method to define mock.On call

  • ctx context.Context

type MockCommands_StartAggregator_Call

type MockCommands_StartAggregator_Call struct {
	*mock.Call
}

MockCommands_StartAggregator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartAggregator'

func (*MockCommands_StartAggregator_Call) Return

func (*MockCommands_StartAggregator_Call) Run

func (*MockCommands_StartAggregator_Call) RunAndReturn

type MockQueries

type MockQueries struct {
	mock.Mock
}

MockQueries is an autogenerated mock type for the mockQueries type

func NewMockQueries

func NewMockQueries(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockQueries

NewMockQueries creates a new instance of MockQueries. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockQueries) EXPECT

func (_m *MockQueries) EXPECT() *MockQueries_Expecter

func (*MockQueries) GetTopKItems

func (_m *MockQueries) GetTopKItems(_a0 context.Context, params GetTopKItemsParams) (*GetTopKItemsResponse, error)

GetTopKItems provides a mock function with given fields: _a0, params

type MockQueries_Expecter

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

func (*MockQueries_Expecter) GetTopKItems

func (_e *MockQueries_Expecter) GetTopKItems(_a0 interface{}, params interface{}) *MockQueries_GetTopKItems_Call

GetTopKItems is a helper method to define mock.On call

  • _a0 context.Context
  • params GetTopKItemsParams

type MockQueries_GetTopKItems_Call

type MockQueries_GetTopKItems_Call struct {
	*mock.Call
}

MockQueries_GetTopKItems_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTopKItems'

func (*MockQueries_GetTopKItems_Call) Return

func (*MockQueries_GetTopKItems_Call) Run

func (*MockQueries_GetTopKItems_Call) RunAndReturn

type Queries

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

func NewQueries

func NewQueries(deps QueriesDeps) *Queries

func (*Queries) GetTopKItems

func (q *Queries) GetTopKItems(
	_ context.Context,
	params GetTopKItemsParams,
) (*GetTopKItemsResponse, error)

type QueriesDeps

type QueriesDeps struct {
	dig.In

	// package private components
	AggregationState aggregationState
}

type TopKItem

type TopKItem struct {
	ItemID string `json:"itemId"`
	Count  int64  `json:"count"`
}

Jump to

Keyboard shortcuts

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