ports

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSubStore added in v0.4.0

type PubSubStore interface {
	// Init initialize the store with an optional encryption password.
	Init(password string) error
	// IsLocked returns wheter the store is locked.
	IsLocked() bool
	// Lock locks the store.
	Lock()
	// UnlockStore unlocks the internal store.
	Unlock(password string) error
	// ChangePassword allows to change the encryption password.
	ChangePassword(oldPwd, newPwd string) error
	// Close should be used to gracefully close the connection with the store.
	Close() error
}

PubSubStore defines the methods to manage the internal store of a SecurePubSub service.

type RepoManager added in v0.3.1

type RepoManager interface {
	VaultRepository() domain.VaultRepository
	MarketRepository() domain.MarketRepository
	UnspentRepository() domain.UnspentRepository
	TradeRepository() domain.TradeRepository
	DepositRepository() domain.DepositRepository
	WithdrawalRepository() domain.WithdrawalRepository

	Close()

	NewTransaction() Transaction
	NewPricesTransaction() Transaction
	NewUnspentsTransaction() Transaction
	RunTransaction(
		ctx context.Context,
		readOnly bool,
		handler func(ctx context.Context) (interface{}, error),
	) (interface{}, error)
	RunUnspentsTransaction(
		ctx context.Context,
		readOnly bool,
		handler func(ctx context.Context) (interface{}, error),
	) (interface{}, error)
	RunPricesTransaction(
		ctx context.Context,
		readOnly bool,
		handler func(ctx context.Context) (interface{}, error),
	) (interface{}, error)
}

RepoManager interface defines the methods for swap, price and unspent.

type SecurePubSub added in v0.4.0

type SecurePubSub interface {
	// Store returns the internal store.
	Store() PubSubStore
	// Subscribes some client for a topic.
	Subscribe(topic string, args ...interface{}) (string, error)
	// Unsubscribe removes some client defined by its id for a topic.
	Unsubscribe(topic, id string) error
	// ListSubscriptionsForTopic returns the info of all clients subscribed for
	// a certain topic.
	ListSubscriptionsForTopic(topic string) []Subscription
	// Publish publishes a message for a certain topic. All clients subscribed
	// for such topic will receive the message.
	Publish(topic string, message string) error
	// TopicsByCode returns the all the topics supported by the service mapped by their
	// code.
	TopicsByCode() map[int]Topic
	// TopicsByLabel returns the all the topics supported by the service mapped by their
	// label.
	TopicsByLabel() map[string]Topic
}

SecurePubSub defines the methods of a pubsub service and its internal store. This service might need to store some data in memory or on the disk, for this reason along with the typical methods of a pubsub service, allows to manage an internal optionally encrypted storage.

type Subscription added in v0.4.0

type Subscription interface {
	Topic() Topic
	Id() string
	IsSecured() bool
	NotifyAt() string
}

type Topic added in v0.4.0

type Topic interface {
	Code() int
	Label() string
}

type Transaction

type Transaction interface {
	Commit() error
	Discard()
}

Transaction interface defines the method to commit or discard a database transaction.

Jump to

Keyboard shortcuts

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