Documentation ¶
Index ¶
- func NewAgateStoreCloseError(err error) error
- func NewDefaultStoreBatchOperationError(err error) error
- func NewDefaultStoreDatabaseConnectionError(err error) error
- func NewDefaultStoreRelayListDecodingError(err error) error
- func NewDefaultStoreRelayListingError(err error) error
- func NewDefaultStoreTransactionCommitError(err error) error
- func NewDefaultStoreTransactionExecutionError(err error) error
- func NewDefaultStoreTransactionInitializationError(err error) error
- func NewDefaultStoreTransactionRollbackError(err error) error
- func NewNonInitializedTransactionerError(method string) error
- type DefaultStore
- func (store *DefaultStore) Close()
- func (store *DefaultStore) CreateBids(ctx context.Context, bids []*models.Bid) error
- func (store *DefaultStore) CreateRelays(ctx context.Context, relays []*models.Relay) error
- func (store *DefaultStore) CreateSubmissions(ctx context.Context, submissions []*models.Submission) error
- func (store *DefaultStore) ExecInTx(ctx context.Context, fn func(store store.Store) error) error
- func (store *DefaultStore) Init(ctx context.Context, databaseURL string) error
- func (store *DefaultStore) ListRelays(ctx context.Context) ([]models.Relay, error)
- type NonInitializedTransactionerError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAgateStoreCloseError ¶
func NewDefaultStoreBatchOperationError ¶
NewDefaultStoreBatchOperationError is raised when a batch operation fails to be performed.
func NewDefaultStoreDatabaseConnectionError ¶
NewDefaultStoreDatabaseConnectionError is raised if the default agate store cannot connect to the postgres database.
func NewDefaultStoreRelayListDecodingError ¶
NewDefaultStoreRelayListDecodingError is raised when the received relay list fails to be decoded in a go object.
func NewDefaultStoreRelayListingError ¶
NewDefaultStoreRelayListingError is raised when the relays stored in the database can not be listed.
func NewDefaultStoreTransactionCommitError ¶
NewDefaultStoreTransactionCommitError is raised when a transaction failed to be committed to the database.
func NewDefaultStoreTransactionExecutionError ¶
NewDefaultStoreTransactionExecutionError is raised when one of the sub-operation of a transaction has failed.
func NewDefaultStoreTransactionInitializationError ¶
NewDefaultStoreTransactionInitializationError is raised when the transaction object used to perform multiple operations in the database fails to be initialized.
func NewDefaultStoreTransactionRollbackError ¶
NewDefaultStoreTransactionRollbackError is raised when a rollback triggered by an error which occurred during a transaction execution fails to complete.
func NewNonInitializedTransactionerError ¶
NewNonInitializedTransactionerError creates an initialized NonInitializedTransactionerError given the name of the method attempting to perform the "unprotected" write operation in the database.
Types ¶
type DefaultStore ¶
type DefaultStore struct {
// contains filtered or unexported fields
}
The DefaultStore is an implementation of the Store which connects to a Postgres database to store the relay data.
func NewDefaultStore ¶
func NewDefaultStore() *DefaultStore
NewDefaultStore creates an empty and non-initialized DefaultStore.
func (*DefaultStore) Close ¶
func (store *DefaultStore) Close()
func (*DefaultStore) CreateBids ¶
func (*DefaultStore) CreateRelays ¶
func (*DefaultStore) CreateSubmissions ¶
func (store *DefaultStore) CreateSubmissions(ctx context.Context, submissions []*models.Submission) error
func (*DefaultStore) Init ¶
func (store *DefaultStore) Init(ctx context.Context, databaseURL string) error
Init initializes a DefaultStore given the postgres database URL.
func (*DefaultStore) ListRelays ¶
type NonInitializedTransactionerError ¶
type NonInitializedTransactionerError struct {
Method string
}
NonInitializedTransactionerError is the error raised by the store when it attempts to perform a write operation on the database which should have been wrapped in a transaction - which is not initialized, therefore causing the error.
func (*NonInitializedTransactionerError) Error ¶
func (e *NonInitializedTransactionerError) Error() string