mock

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Close           = "Close"
	ReadOnly        = "ReadOnly"
	Insert          = "Insert"
	List            = "List"
	Retrieve        = "Retrieve"
	Destroy         = "Destroy"
	Indash          = "Indash"
	Unhash          = "Unhash"
	LoadIndash      = "LoadIndash"
	ClearIndash     = "ClearIndash"
	AllowedTopics   = "AllowedTopics"
	ListTopics      = "ListTopics"
	CreateTopic     = "CreateTopic"
	RetrieveTopic   = "RetrieveTopic"
	UpdateTopic     = "UpdateTopic"
	DeleteTopic     = "DeleteTopic"
	ListTopicNames  = "ListTopicNames"
	TopicExists     = "TopicExists"
	TopicName       = "TopicName"
	LookupTopicID   = "LookupTopicID"
	ListAllTopics   = "ListAllTopics"
	TopicInfo       = "TopicInfo"
	UpdateTopicInfo = "UpdateTopicInfo"
)

Constants are used to reference store methods in mock code

Variables

This section is empty.

Functions

func EventListFixture added in v0.9.0

func EventListFixture(path string) (_ []*api.EventWrapper, err error)

func GroupListFixture added in v0.9.0

func GroupListFixture(path string) (_ []*api.ConsumerGroup, err error)

func TopicInfoListFixture added in v0.9.0

func TopicInfoListFixture(path string) (_ map[string]*api.TopicInfo, err error)

func TopicListFixture added in v0.9.0

func TopicListFixture(path string) (_ []*api.Topic, err error)

func TopicNamesListFixture added in v0.9.0

func TopicNamesListFixture(path string) (_ []*api.TopicName, err error)

func UnmarshalEventList added in v0.9.0

func UnmarshalEventList(data []byte) (events []*api.EventWrapper, err error)

func UnmarshalGroupList added in v0.9.0

func UnmarshalGroupList(data []byte) (groups []*api.ConsumerGroup, err error)

func UnmarshalTopicInfoList added in v0.9.0

func UnmarshalTopicInfoList(data []byte) (infos map[string]*api.TopicInfo, err error)

func UnmarshalTopicList added in v0.5.1

func UnmarshalTopicList(data []byte) (topics []*api.Topic, err error)

func UnmarshalTopicNamesList added in v0.9.0

func UnmarshalTopicNamesList(data []byte) (names []*api.TopicName, err error)

Types

type EventIterator added in v0.9.0

type EventIterator struct {
	MockIterator
}

func NewEventErrorIterator added in v0.9.0

func NewEventErrorIterator(err error) *EventIterator

func NewEventIterator added in v0.9.0

func NewEventIterator(events []*api.EventWrapper) *EventIterator

func (*EventIterator) Event added in v0.9.0

func (t *EventIterator) Event() (*api.EventWrapper, error)

func (*EventIterator) Seek added in v0.9.0

func (t *EventIterator) Seek(eventID rlid.RLID) bool

type IndashIterator added in v0.11.0

type IndashIterator struct {
	MockIterator
}

func NewIndashErrorIterator added in v0.11.0

func NewIndashErrorIterator(err error) *IndashIterator

func NewIndashIterator added in v0.11.0

func NewIndashIterator(hashes [][]byte) *IndashIterator

func (*IndashIterator) Hash added in v0.11.0

func (t *IndashIterator) Hash() ([]byte, error)

type MockIterator added in v0.9.0

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

func (*MockIterator) Error added in v0.9.0

func (i *MockIterator) Error() error

func (*MockIterator) Key added in v0.9.0

func (i *MockIterator) Key() []byte

func (*MockIterator) Next added in v0.9.0

func (i *MockIterator) Next() bool

func (*MockIterator) Object added in v0.9.0

func (i *MockIterator) Object() (interface{}, error)

func (*MockIterator) Page added in v0.9.0

func (i *MockIterator) Page(in *api.PageInfo) (out []interface{}, token string, err error)

func (*MockIterator) Prev added in v0.9.0

func (i *MockIterator) Prev() bool

func (*MockIterator) Release added in v0.9.0

func (i *MockIterator) Release()

func (*MockIterator) Value added in v0.9.0

func (i *MockIterator) Value() []byte

type Store

type Store struct {
	sync.RWMutex

	OnClose           func() error
	OnReadOnly        func() bool
	OnAllowedTopics   func(ulid.ULID) ([]ulid.ULID, error)
	OnInsert          func(*api.EventWrapper) error
	OnList            func(ulid.ULID) iterator.EventIterator
	OnRetrieve        func(ulid.ULID, rlid.RLID) (*api.EventWrapper, error)
	OnDestroy         func(ulid.ULID) error
	OnIndash          func(ulid.ULID, []byte, rlid.RLID) error
	OnUnhash          func(ulid.ULID, []byte) (*api.EventWrapper, error)
	OnLoadIndash      func(ulid.ULID) iterator.IndashIterator
	OnClearIndash     func(ulid.ULID) error
	OnListTopics      func(ulid.ULID) iterator.TopicIterator
	OnCreateTopic     func(*api.Topic) error
	OnRetrieveTopic   func(topicID ulid.ULID) (*api.Topic, error)
	OnUpdateTopic     func(*api.Topic) error
	OnDeleteTopic     func(topicID ulid.ULID) error
	OnListTopicNames  func(ulid.ULID) iterator.TopicNamesIterator
	OnTopicExists     func(*api.TopicName) (*api.TopicExistsInfo, error)
	OnTopicName       func(ulid.ULID) (string, error)
	OnLookupTopicID   func(string, ulid.ULID) (ulid.ULID, error)
	OnListAllTopics   func() iterator.TopicIterator
	OnTopicInfo       func(ulid.ULID) (*api.TopicInfo, error)
	OnUpdateTopicInfo func(*api.TopicInfo) error
	// contains filtered or unexported fields
}

Implements both a store.EventStore and a store.MetaStore for testing purposes.

func Open

func Open(conf config.StorageConfig) (*Store, error)

func (*Store) AllowedTopics added in v0.5.1

func (s *Store) AllowedTopics(projectID ulid.ULID) ([]ulid.ULID, error)

func (*Store) Calls

func (s *Store) Calls(call string) int

func (*Store) ClearIndash added in v0.12.0

func (s *Store) ClearIndash(topicID ulid.ULID) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateTopic

func (s *Store) CreateTopic(topic *api.Topic) error

func (*Store) DeleteTopic

func (s *Store) DeleteTopic(topicID ulid.ULID) error

func (*Store) Destroy added in v0.12.0

func (s *Store) Destroy(topicID ulid.ULID) error

func (*Store) Indash added in v0.11.0

func (s *Store) Indash(topicID ulid.ULID, hash []byte, eventID rlid.RLID) error

func (*Store) Insert added in v0.9.0

func (s *Store) Insert(in *api.EventWrapper) error

func (*Store) List added in v0.9.0

func (s *Store) List(topicID ulid.ULID) iterator.EventIterator

func (*Store) ListAllTopics added in v0.9.0

func (s *Store) ListAllTopics() iterator.TopicIterator

func (*Store) ListTopicNames added in v0.5.1

func (s *Store) ListTopicNames(projectID ulid.ULID) iterator.TopicNamesIterator

func (*Store) ListTopics

func (s *Store) ListTopics(projectID ulid.ULID) iterator.TopicIterator

func (*Store) LoadIndash added in v0.11.0

func (s *Store) LoadIndash(topicID ulid.ULID) iterator.IndashIterator

func (*Store) LookupTopicID added in v0.9.0

func (s *Store) LookupTopicID(name string, projectID ulid.ULID) (topicID ulid.ULID, err error)

func (*Store) ReadOnly

func (s *Store) ReadOnly() bool

func (*Store) Reset

func (s *Store) Reset()

func (*Store) Retrieve added in v0.9.0

func (s *Store) Retrieve(topicID ulid.ULID, eventID rlid.RLID) (*api.EventWrapper, error)

func (*Store) RetrieveTopic

func (s *Store) RetrieveTopic(topicID ulid.ULID) (*api.Topic, error)

func (*Store) TopicExists added in v0.5.1

func (s *Store) TopicExists(in *api.TopicName) (*api.TopicExistsInfo, error)

func (*Store) TopicInfo added in v0.9.0

func (s *Store) TopicInfo(topicID ulid.ULID) (*api.TopicInfo, error)

func (*Store) TopicName added in v0.7.0

func (s *Store) TopicName(topicID ulid.ULID) (string, error)

func (*Store) Unhash added in v0.12.0

func (s *Store) Unhash(topicID ulid.ULID, hash []byte) (*api.EventWrapper, error)

func (*Store) UpdateTopic

func (s *Store) UpdateTopic(topic *api.Topic) error

func (*Store) UpdateTopicInfo added in v0.9.0

func (s *Store) UpdateTopicInfo(info *api.TopicInfo) error

func (*Store) UseError

func (s *Store) UseError(call string, err error) error

func (*Store) UseFixture

func (s *Store) UseFixture(call, path string) (err error)

type TopicIterator

type TopicIterator struct {
	MockIterator
}

func NewTopicErrorIterator added in v0.9.0

func NewTopicErrorIterator(err error) *TopicIterator

func NewTopicIterator

func NewTopicIterator(topics []*api.Topic) *TopicIterator

func (*TopicIterator) NextPage

func (t *TopicIterator) NextPage(in *api.PageInfo) (out *api.TopicsPage, err error)

func (*TopicIterator) Topic

func (t *TopicIterator) Topic() (*api.Topic, error)

type TopicNamesIterator added in v0.9.0

type TopicNamesIterator struct {
	MockIterator
}

func NewTopicNamesErrorIterator added in v0.9.0

func NewTopicNamesErrorIterator(err error) *TopicNamesIterator

func NewTopicNamesIterator added in v0.9.0

func NewTopicNamesIterator(names []*api.TopicName) *TopicNamesIterator

func (*TopicNamesIterator) NextPage added in v0.9.0

func (t *TopicNamesIterator) NextPage(in *api.PageInfo) (out *api.TopicNamesPage, err error)

func (*TopicNamesIterator) TopicName added in v0.9.0

func (t *TopicNamesIterator) TopicName() (*api.TopicName, error)

Jump to

Keyboard shortcuts

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