Documentation ¶
Overview ¶
Package offers is a generated GoMock package.
Package offers provides management of the offers being made by a swapd instance.
Index ¶
- type Database
- type Manager
- func (m *Manager) AddOffer(offer *types.Offer, useRelayer bool) (*types.OfferExtra, error)
- func (m *Manager) ClearAllOffers() error
- func (m *Manager) ClearOfferIDs(ids []types.Hash) error
- func (m *Manager) DeleteOffer(id types.Hash) error
- func (m *Manager) GetOffer(id types.Hash) (*types.Offer, *types.OfferExtra, error)
- func (m *Manager) GetOffers() []*types.Offer
- func (m *Manager) NumOffers() int
- func (m *Manager) TakeOffer(id types.Hash) (*types.Offer, *types.OfferExtra, error)
- type MockDatabase
- func (m *MockDatabase) ClearAllOffers() error
- func (m *MockDatabase) DeleteOffer(arg0 common.Hash) error
- func (m *MockDatabase) EXPECT() *MockDatabaseMockRecorder
- func (m *MockDatabase) GetAllOffers() ([]*types.Offer, error)
- func (m *MockDatabase) GetOffer(arg0 common.Hash) (*types.Offer, error)
- func (m *MockDatabase) PutOffer(arg0 *types.Offer) error
- type MockDatabaseMockRecorder
- func (mr *MockDatabaseMockRecorder) ClearAllOffers() *gomock.Call
- func (mr *MockDatabaseMockRecorder) DeleteOffer(arg0 interface{}) *gomock.Call
- func (mr *MockDatabaseMockRecorder) GetAllOffers() *gomock.Call
- func (mr *MockDatabaseMockRecorder) GetOffer(arg0 interface{}) *gomock.Call
- func (mr *MockDatabaseMockRecorder) PutOffer(arg0 interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { PutOffer(offer *types.Offer) error DeleteOffer(id types.Hash) error GetOffer(id types.Hash) (*types.Offer, error) GetAllOffers() ([]*types.Offer, error) ClearAllOffers() error }
Database contains the db functions used by the offer manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager synchronises access to the offers map.
func NewManager ¶
NewManager creates a new offer manager. The passed in dataDir is the directory where the recovery file is for each individual swap is stored.
func (*Manager) AddOffer ¶
AddOffer adds a new offer to the manager and returns its OffersExtra data
func (*Manager) ClearAllOffers ¶
ClearAllOffers clears all offers.
func (*Manager) ClearOfferIDs ¶
ClearOfferIDs clears the passed in offer IDs if they exist.
func (*Manager) DeleteOffer ¶
DeleteOffer deletes the offer with the given ID, if it exists. No error is returned if there was no matching offer to delete.
func (*Manager) GetOffer ¶
GetOffer returns the offer data structures for the passed ID or nil for both values if the offer ID is not found.
func (*Manager) GetOffers ¶
GetOffers returns all current offers. The returned slice is in random order and will not be the same from one invocation to the next.
type MockDatabase ¶
type MockDatabase struct {
// contains filtered or unexported fields
}
MockDatabase is a mock of Database interface.
func NewMockDatabase ¶
func NewMockDatabase(ctrl *gomock.Controller) *MockDatabase
NewMockDatabase creates a new mock instance.
func (*MockDatabase) ClearAllOffers ¶
func (m *MockDatabase) ClearAllOffers() error
ClearAllOffers mocks base method.
func (*MockDatabase) DeleteOffer ¶
func (m *MockDatabase) DeleteOffer(arg0 common.Hash) error
DeleteOffer mocks base method.
func (*MockDatabase) EXPECT ¶
func (m *MockDatabase) EXPECT() *MockDatabaseMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDatabase) GetAllOffers ¶
func (m *MockDatabase) GetAllOffers() ([]*types.Offer, error)
GetAllOffers mocks base method.
type MockDatabaseMockRecorder ¶
type MockDatabaseMockRecorder struct {
// contains filtered or unexported fields
}
MockDatabaseMockRecorder is the mock recorder for MockDatabase.
func (*MockDatabaseMockRecorder) ClearAllOffers ¶
func (mr *MockDatabaseMockRecorder) ClearAllOffers() *gomock.Call
ClearAllOffers indicates an expected call of ClearAllOffers.
func (*MockDatabaseMockRecorder) DeleteOffer ¶
func (mr *MockDatabaseMockRecorder) DeleteOffer(arg0 interface{}) *gomock.Call
DeleteOffer indicates an expected call of DeleteOffer.
func (*MockDatabaseMockRecorder) GetAllOffers ¶
func (mr *MockDatabaseMockRecorder) GetAllOffers() *gomock.Call
GetAllOffers indicates an expected call of GetAllOffers.
func (*MockDatabaseMockRecorder) GetOffer ¶
func (mr *MockDatabaseMockRecorder) GetOffer(arg0 interface{}) *gomock.Call
GetOffer indicates an expected call of GetOffer.
func (*MockDatabaseMockRecorder) PutOffer ¶
func (mr *MockDatabaseMockRecorder) PutOffer(arg0 interface{}) *gomock.Call
PutOffer indicates an expected call of PutOffer.