store

package
v0.0.0-...-748bfe2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyRegistered = errors.New("partition is alreay registered")
View Source
var ErrInvalidLease = errors.New("invalid lease")
View Source
var ErrNewerPositionCommitted = errors.New("a newer position has already been commited")

Functions

func New

func New(db *badger.DB) *store

Types

type ApplyResponse

type ApplyResponse struct {
	Error error
}

type MockStore

type MockStore struct {
	mock.Mock
}

MockStore is an autogenerated mock type for the Store type

func NewMockStore

func NewMockStore(t interface {
	mock.TestingT
	Cleanup(func())
}) *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. The first argument is typically a *testing.T value.

func (*MockStore) Apply

func (_mock *MockStore) Apply(l *raft.Log) any

Apply provides a mock function for the type MockStore

func (*MockStore) CommitGroupPosition

func (_mock *MockStore) CommitGroupPosition(stream string, group string, parition int64, position string) error

CommitGroupPosition provides a mock function for the type MockStore

func (*MockStore) DeleteStream

func (_mock *MockStore) DeleteStream(name string) error

DeleteStream provides a mock function for the type MockStore

func (*MockStore) EXPECT

func (_m *MockStore) EXPECT() *MockStore_Expecter

func (*MockStore) ExtendLease

func (_mock *MockStore) ExtendLease(worker *kayakv1.Worker, expires time.Duration) error

ExtendLease provides a mock function for the type MockStore

func (*MockStore) GetGroupInformation

func (_mock *MockStore) GetGroupInformation(streamName string, groupName string) (*kayakv1.Group, error)

GetGroupInformation provides a mock function for the type MockStore

func (*MockStore) GetGroupPosition

func (_mock *MockStore) GetGroupPosition(stream string, group string, partition int64) (string, error)

GetGroupPosition provides a mock function for the type MockStore

func (*MockStore) GetPartitionAssignment

func (_mock *MockStore) GetPartitionAssignment(stream string, group string, partition int64) (string, error)

GetPartitionAssignment provides a mock function for the type MockStore

func (*MockStore) GetPartitionAssignments

func (_mock *MockStore) GetPartitionAssignments(stream string, group string) (map[int64]*kayakv1.PartitionAssignment, error)

GetPartitionAssignments provides a mock function for the type MockStore

func (*MockStore) GetRecords

func (_mock *MockStore) GetRecords(streamName string, partition int64, startPosition string, limit int) ([]*kayakv1.Record, error)

GetRecords provides a mock function for the type MockStore

func (*MockStore) GetStream

func (_mock *MockStore) GetStream(name string) (*kayakv1.Stream, error)

GetStream provides a mock function for the type MockStore

func (*MockStore) GetStreamStats

func (_mock *MockStore) GetStreamStats(name string) (*kayakv1.StreamStats, error)

GetStreamStats provides a mock function for the type MockStore

func (*MockStore) GetStreams

func (_mock *MockStore) GetStreams() ([]*kayakv1.Stream, error)

GetStreams provides a mock function for the type MockStore

func (*MockStore) HasLease

func (_mock *MockStore) HasLease(worker *kayakv1.Worker) error

HasLease provides a mock function for the type MockStore

func (*MockStore) PutRecords

func (_mock *MockStore) PutRecords(streamName string, records ...*kayakv1.Record) error

PutRecords provides a mock function for the type MockStore

func (*MockStore) PutStream

func (_mock *MockStore) PutStream(stream *kayakv1.Stream) error

PutStream provides a mock function for the type MockStore

func (*MockStore) RemoveLease

func (_mock *MockStore) RemoveLease(worker *kayakv1.Worker) error

RemoveLease provides a mock function for the type MockStore

func (*MockStore) Restore

func (_mock *MockStore) Restore(snapshot io.ReadCloser) error

Restore provides a mock function for the type MockStore

func (*MockStore) Snapshot

func (_mock *MockStore) Snapshot() (raft.FSMSnapshot, error)

Snapshot provides a mock function for the type MockStore

type MockStore_Apply_Call

type MockStore_Apply_Call struct {
	*mock.Call
}

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

func (*MockStore_Apply_Call) Return

func (*MockStore_Apply_Call) Run

func (_c *MockStore_Apply_Call) Run(run func(l *raft.Log)) *MockStore_Apply_Call

func (*MockStore_Apply_Call) RunAndReturn

func (_c *MockStore_Apply_Call) RunAndReturn(run func(l *raft.Log) any) *MockStore_Apply_Call

type MockStore_CommitGroupPosition_Call

type MockStore_CommitGroupPosition_Call struct {
	*mock.Call
}

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

func (*MockStore_CommitGroupPosition_Call) Return

func (*MockStore_CommitGroupPosition_Call) Run

func (_c *MockStore_CommitGroupPosition_Call) Run(run func(stream string, group string, parition int64, position string)) *MockStore_CommitGroupPosition_Call

func (*MockStore_CommitGroupPosition_Call) RunAndReturn

func (_c *MockStore_CommitGroupPosition_Call) RunAndReturn(run func(stream string, group string, parition int64, position string) error) *MockStore_CommitGroupPosition_Call

type MockStore_DeleteStream_Call

type MockStore_DeleteStream_Call struct {
	*mock.Call
}

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

func (*MockStore_DeleteStream_Call) Return

func (*MockStore_DeleteStream_Call) Run

func (*MockStore_DeleteStream_Call) RunAndReturn

func (_c *MockStore_DeleteStream_Call) RunAndReturn(run func(name string) error) *MockStore_DeleteStream_Call

type MockStore_Expecter

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

func (*MockStore_Expecter) Apply

func (_e *MockStore_Expecter) Apply(l interface{}) *MockStore_Apply_Call

Apply is a helper method to define mock.On call

  • l

func (*MockStore_Expecter) CommitGroupPosition

func (_e *MockStore_Expecter) CommitGroupPosition(stream interface{}, group interface{}, parition interface{}, position interface{}) *MockStore_CommitGroupPosition_Call

CommitGroupPosition is a helper method to define mock.On call

  • stream
  • group
  • parition
  • position

func (*MockStore_Expecter) DeleteStream

func (_e *MockStore_Expecter) DeleteStream(name interface{}) *MockStore_DeleteStream_Call

DeleteStream is a helper method to define mock.On call

  • name

func (*MockStore_Expecter) ExtendLease

func (_e *MockStore_Expecter) ExtendLease(worker interface{}, expires interface{}) *MockStore_ExtendLease_Call

ExtendLease is a helper method to define mock.On call

  • worker
  • expires

func (*MockStore_Expecter) GetGroupInformation

func (_e *MockStore_Expecter) GetGroupInformation(streamName interface{}, groupName interface{}) *MockStore_GetGroupInformation_Call

GetGroupInformation is a helper method to define mock.On call

  • streamName
  • groupName

func (*MockStore_Expecter) GetGroupPosition

func (_e *MockStore_Expecter) GetGroupPosition(stream interface{}, group interface{}, partition interface{}) *MockStore_GetGroupPosition_Call

GetGroupPosition is a helper method to define mock.On call

  • stream
  • group
  • partition

func (*MockStore_Expecter) GetPartitionAssignment

func (_e *MockStore_Expecter) GetPartitionAssignment(stream interface{}, group interface{}, partition interface{}) *MockStore_GetPartitionAssignment_Call

GetPartitionAssignment is a helper method to define mock.On call

  • stream
  • group
  • partition

func (*MockStore_Expecter) GetPartitionAssignments

func (_e *MockStore_Expecter) GetPartitionAssignments(stream interface{}, group interface{}) *MockStore_GetPartitionAssignments_Call

GetPartitionAssignments is a helper method to define mock.On call

  • stream
  • group

func (*MockStore_Expecter) GetRecords

func (_e *MockStore_Expecter) GetRecords(streamName interface{}, partition interface{}, startPosition interface{}, limit interface{}) *MockStore_GetRecords_Call

GetRecords is a helper method to define mock.On call

  • streamName
  • partition
  • startPosition
  • limit

func (*MockStore_Expecter) GetStream

func (_e *MockStore_Expecter) GetStream(name interface{}) *MockStore_GetStream_Call

GetStream is a helper method to define mock.On call

  • name

func (*MockStore_Expecter) GetStreamStats

func (_e *MockStore_Expecter) GetStreamStats(name interface{}) *MockStore_GetStreamStats_Call

GetStreamStats is a helper method to define mock.On call

  • name

func (*MockStore_Expecter) GetStreams

GetStreams is a helper method to define mock.On call

func (*MockStore_Expecter) HasLease

func (_e *MockStore_Expecter) HasLease(worker interface{}) *MockStore_HasLease_Call

HasLease is a helper method to define mock.On call

  • worker

func (*MockStore_Expecter) PutRecords

func (_e *MockStore_Expecter) PutRecords(streamName interface{}, records ...interface{}) *MockStore_PutRecords_Call

PutRecords is a helper method to define mock.On call

  • streamName
  • records

func (*MockStore_Expecter) PutStream

func (_e *MockStore_Expecter) PutStream(stream interface{}) *MockStore_PutStream_Call

PutStream is a helper method to define mock.On call

  • stream

func (*MockStore_Expecter) RemoveLease

func (_e *MockStore_Expecter) RemoveLease(worker interface{}) *MockStore_RemoveLease_Call

RemoveLease is a helper method to define mock.On call

  • worker

func (*MockStore_Expecter) Restore

func (_e *MockStore_Expecter) Restore(snapshot interface{}) *MockStore_Restore_Call

Restore is a helper method to define mock.On call

  • snapshot

func (*MockStore_Expecter) Snapshot

Snapshot is a helper method to define mock.On call

type MockStore_ExtendLease_Call

type MockStore_ExtendLease_Call struct {
	*mock.Call
}

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

func (*MockStore_ExtendLease_Call) Return

func (*MockStore_ExtendLease_Call) Run

func (*MockStore_ExtendLease_Call) RunAndReturn

func (_c *MockStore_ExtendLease_Call) RunAndReturn(run func(worker *kayakv1.Worker, expires time.Duration) error) *MockStore_ExtendLease_Call

type MockStore_GetGroupInformation_Call

type MockStore_GetGroupInformation_Call struct {
	*mock.Call
}

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

func (*MockStore_GetGroupInformation_Call) Return

func (*MockStore_GetGroupInformation_Call) Run

func (_c *MockStore_GetGroupInformation_Call) Run(run func(streamName string, groupName string)) *MockStore_GetGroupInformation_Call

func (*MockStore_GetGroupInformation_Call) RunAndReturn

func (_c *MockStore_GetGroupInformation_Call) RunAndReturn(run func(streamName string, groupName string) (*kayakv1.Group, error)) *MockStore_GetGroupInformation_Call

type MockStore_GetGroupPosition_Call

type MockStore_GetGroupPosition_Call struct {
	*mock.Call
}

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

func (*MockStore_GetGroupPosition_Call) Return

func (*MockStore_GetGroupPosition_Call) Run

func (_c *MockStore_GetGroupPosition_Call) Run(run func(stream string, group string, partition int64)) *MockStore_GetGroupPosition_Call

func (*MockStore_GetGroupPosition_Call) RunAndReturn

func (_c *MockStore_GetGroupPosition_Call) RunAndReturn(run func(stream string, group string, partition int64) (string, error)) *MockStore_GetGroupPosition_Call

type MockStore_GetPartitionAssignment_Call

type MockStore_GetPartitionAssignment_Call struct {
	*mock.Call
}

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

func (*MockStore_GetPartitionAssignment_Call) Return

func (*MockStore_GetPartitionAssignment_Call) Run

func (*MockStore_GetPartitionAssignment_Call) RunAndReturn

func (_c *MockStore_GetPartitionAssignment_Call) RunAndReturn(run func(stream string, group string, partition int64) (string, error)) *MockStore_GetPartitionAssignment_Call

type MockStore_GetPartitionAssignments_Call

type MockStore_GetPartitionAssignments_Call struct {
	*mock.Call
}

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

func (*MockStore_GetPartitionAssignments_Call) Return

func (*MockStore_GetPartitionAssignments_Call) Run

func (*MockStore_GetPartitionAssignments_Call) RunAndReturn

type MockStore_GetRecords_Call

type MockStore_GetRecords_Call struct {
	*mock.Call
}

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

func (*MockStore_GetRecords_Call) Return

func (*MockStore_GetRecords_Call) Run

func (_c *MockStore_GetRecords_Call) Run(run func(streamName string, partition int64, startPosition string, limit int)) *MockStore_GetRecords_Call

func (*MockStore_GetRecords_Call) RunAndReturn

func (_c *MockStore_GetRecords_Call) RunAndReturn(run func(streamName string, partition int64, startPosition string, limit int) ([]*kayakv1.Record, error)) *MockStore_GetRecords_Call

type MockStore_GetStreamStats_Call

type MockStore_GetStreamStats_Call struct {
	*mock.Call
}

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

func (*MockStore_GetStreamStats_Call) Return

func (*MockStore_GetStreamStats_Call) Run

func (*MockStore_GetStreamStats_Call) RunAndReturn

type MockStore_GetStream_Call

type MockStore_GetStream_Call struct {
	*mock.Call
}

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

func (*MockStore_GetStream_Call) Return

func (*MockStore_GetStream_Call) Run

func (_c *MockStore_GetStream_Call) Run(run func(name string)) *MockStore_GetStream_Call

func (*MockStore_GetStream_Call) RunAndReturn

func (_c *MockStore_GetStream_Call) RunAndReturn(run func(name string) (*kayakv1.Stream, error)) *MockStore_GetStream_Call

type MockStore_GetStreams_Call

type MockStore_GetStreams_Call struct {
	*mock.Call
}

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

func (*MockStore_GetStreams_Call) Return

func (*MockStore_GetStreams_Call) Run

func (*MockStore_GetStreams_Call) RunAndReturn

func (_c *MockStore_GetStreams_Call) RunAndReturn(run func() ([]*kayakv1.Stream, error)) *MockStore_GetStreams_Call

type MockStore_HasLease_Call

type MockStore_HasLease_Call struct {
	*mock.Call
}

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

func (*MockStore_HasLease_Call) Return

func (*MockStore_HasLease_Call) Run

func (_c *MockStore_HasLease_Call) Run(run func(worker *kayakv1.Worker)) *MockStore_HasLease_Call

func (*MockStore_HasLease_Call) RunAndReturn

func (_c *MockStore_HasLease_Call) RunAndReturn(run func(worker *kayakv1.Worker) error) *MockStore_HasLease_Call

type MockStore_PutRecords_Call

type MockStore_PutRecords_Call struct {
	*mock.Call
}

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

func (*MockStore_PutRecords_Call) Return

func (*MockStore_PutRecords_Call) Run

func (_c *MockStore_PutRecords_Call) Run(run func(streamName string, records ...*kayakv1.Record)) *MockStore_PutRecords_Call

func (*MockStore_PutRecords_Call) RunAndReturn

func (_c *MockStore_PutRecords_Call) RunAndReturn(run func(streamName string, records ...*kayakv1.Record) error) *MockStore_PutRecords_Call

type MockStore_PutStream_Call

type MockStore_PutStream_Call struct {
	*mock.Call
}

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

func (*MockStore_PutStream_Call) Return

func (*MockStore_PutStream_Call) Run

func (*MockStore_PutStream_Call) RunAndReturn

func (_c *MockStore_PutStream_Call) RunAndReturn(run func(stream *kayakv1.Stream) error) *MockStore_PutStream_Call

type MockStore_RemoveLease_Call

type MockStore_RemoveLease_Call struct {
	*mock.Call
}

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

func (*MockStore_RemoveLease_Call) Return

func (*MockStore_RemoveLease_Call) Run

func (*MockStore_RemoveLease_Call) RunAndReturn

func (_c *MockStore_RemoveLease_Call) RunAndReturn(run func(worker *kayakv1.Worker) error) *MockStore_RemoveLease_Call

type MockStore_Restore_Call

type MockStore_Restore_Call struct {
	*mock.Call
}

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

func (*MockStore_Restore_Call) Return

func (*MockStore_Restore_Call) Run

func (_c *MockStore_Restore_Call) Run(run func(snapshot io.ReadCloser)) *MockStore_Restore_Call

func (*MockStore_Restore_Call) RunAndReturn

func (_c *MockStore_Restore_Call) RunAndReturn(run func(snapshot io.ReadCloser) error) *MockStore_Restore_Call

type MockStore_Snapshot_Call

type MockStore_Snapshot_Call struct {
	*mock.Call
}

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

func (*MockStore_Snapshot_Call) Return

func (*MockStore_Snapshot_Call) Run

func (_c *MockStore_Snapshot_Call) Run(run func()) *MockStore_Snapshot_Call

func (*MockStore_Snapshot_Call) RunAndReturn

func (_c *MockStore_Snapshot_Call) RunAndReturn(run func() (raft.FSMSnapshot, error)) *MockStore_Snapshot_Call

type Store

type Store interface {
	PutStream(stream *kayakv1.Stream) error
	GetStream(name string) (*kayakv1.Stream, error)
	GetStreams() ([]*kayakv1.Stream, error)
	DeleteStream(name string) error

	PutRecords(streamName string, records ...*kayakv1.Record) error
	GetRecords(streamName string, partition int64, startPosition string, limit int) ([]*kayakv1.Record, error)

	// GetLease()
	ExtendLease(worker *kayakv1.Worker, expires time.Duration) error
	RemoveLease(worker *kayakv1.Worker) error
	HasLease(worker *kayakv1.Worker) error
	GetGroupPosition(stream, group string, partition int64) (string, error)
	CommitGroupPosition(stream, group string, parition int64, position string) error
	GetPartitionAssignment(stream, group string, partition int64) (string, error)
	GetPartitionAssignments(stream, group string) (map[int64]*kayakv1.PartitionAssignment, error)
	GetGroupInformation(streamName, groupName string) (*kayakv1.Group, error)
	GetStreamStats(name string) (*kayakv1.StreamStats, error)

	// raft FSM
	Apply(l *raft.Log) any
	Snapshot() (raft.FSMSnapshot, error)
	Restore(snapshot io.ReadCloser) error
}

Jump to

Keyboard shortcuts

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