Documentation ¶
Index ¶
- func NewRegistry(connection nats.Connection) *registryBroker
- type ProposalReducer
- type ProposalStorage
- func (s *ProposalStorage) AddProposal(proposals ...market.ServiceProposal)
- func (s *ProposalStorage) Countries(filter *proposal.Filter) (map[string]int, error)
- func (s *ProposalStorage) FindProposals(filter *proposal.Filter) ([]market.ServiceProposal, error)
- func (s *ProposalStorage) GetProposal(id market.ProposalID) (*market.ServiceProposal, error)
- func (s *ProposalStorage) HasProposal(id market.ProposalID) bool
- func (s *ProposalStorage) MatchProposals(match ProposalReducer) ([]market.ServiceProposal, error)
- func (s *ProposalStorage) Proposals() []market.ServiceProposal
- func (s *ProposalStorage) RemoveProposal(id market.ProposalID)
- func (s *ProposalStorage) Set(proposals []market.ServiceProposal)
- type Repository
- func (r *Repository) Countries(filter *proposal.Filter) (map[string]int, error)
- func (r *Repository) Proposal(id market.ProposalID) (*market.ServiceProposal, error)
- func (r *Repository) Proposals(filter *proposal.Filter) ([]market.ServiceProposal, error)
- func (r *Repository) Start() error
- func (r *Repository) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRegistry ¶
func NewRegistry(connection nats.Connection) *registryBroker
NewRegistry create an instance of Broker registryBroker
Types ¶
type ProposalReducer ¶
type ProposalReducer func(proposal market.ServiceProposal) bool
ProposalReducer proposal match function
type ProposalStorage ¶
type ProposalStorage struct {
// contains filtered or unexported fields
}
ProposalStorage represents table of currently active proposals in Mysterium Discovery
func NewStorage ¶
func NewStorage(eventPublisher eventbus.Publisher) *ProposalStorage
NewStorage creates new instance of ProposalStorage
func (*ProposalStorage) AddProposal ¶
func (s *ProposalStorage) AddProposal(proposals ...market.ServiceProposal)
AddProposal appends given proposal to storage
func (*ProposalStorage) Countries ¶
Countries fetches currently active service proposals from storage by given filter
func (*ProposalStorage) FindProposals ¶
func (s *ProposalStorage) FindProposals(filter *proposal.Filter) ([]market.ServiceProposal, error)
FindProposals fetches currently active service proposals from storage by given filter
func (*ProposalStorage) GetProposal ¶
func (s *ProposalStorage) GetProposal(id market.ProposalID) (*market.ServiceProposal, error)
GetProposal returns proposal from storage
func (*ProposalStorage) HasProposal ¶
func (s *ProposalStorage) HasProposal(id market.ProposalID) bool
HasProposal checks if proposal exists in storage
func (*ProposalStorage) MatchProposals ¶
func (s *ProposalStorage) MatchProposals(match ProposalReducer) ([]market.ServiceProposal, error)
MatchProposals fetches currently active service proposals from storage by match function
func (*ProposalStorage) Proposals ¶
func (s *ProposalStorage) Proposals() []market.ServiceProposal
Proposals returns list of proposals in storage
func (*ProposalStorage) RemoveProposal ¶
func (s *ProposalStorage) RemoveProposal(id market.ProposalID)
RemoveProposal removes proposal from storage
func (*ProposalStorage) Set ¶
func (s *ProposalStorage) Set(proposals []market.ServiceProposal)
Set puts given list proposals to storage
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository provides proposals from the broker.
func NewRepository ¶
func NewRepository( connection nats.Connection, storage *ProposalStorage, proposalTimeoutInterval time.Duration, proposalCheckInterval time.Duration, ) *Repository
NewRepository constructs a new proposal repository (backed by the broker).
func (*Repository) Proposal ¶
func (r *Repository) Proposal(id market.ProposalID) (*market.ServiceProposal, error)
Proposal returns a single proposal by its ID.
func (*Repository) Proposals ¶
func (r *Repository) Proposals(filter *proposal.Filter) ([]market.ServiceProposal, error)
Proposals returns proposals matching the filter.
func (*Repository) Start ¶
func (r *Repository) Start() error
Start begins proposals synchronization to storage
func (*Repository) Stop ¶
func (r *Repository) Stop()
Stop ends proposals synchronization to storage