Documentation ¶
Index ¶
- Constants
- type Filter
- func (f *Filter) SetConsumerID(id identity.Identity) *Filter
- func (f *Filter) SetDirection(direction string) *Filter
- func (f *Filter) SetHermesID(hermesID string) *Filter
- func (f *Filter) SetProviderID(id identity.Identity) *Filter
- func (f *Filter) SetServiceType(serviceType string) *Filter
- func (f *Filter) SetStartedFrom(from time.Time) *Filter
- func (f *Filter) SetStartedTo(to time.Time) *Filter
- func (f *Filter) SetStatus(status string) *Filter
- type History
- type Stats
- type Storage
- func (repo *Storage) GetAll() ([]History, error)
- func (repo *Storage) List(filter *Filter) (result []History, err error)
- func (repo *Storage) Stats(filter *Filter) (result Stats, err error)
- func (repo *Storage) StatsByDay(filter *Filter) (result map[time.Time]Stats, err error)
- func (repo *Storage) Subscribe(bus eventbus.Subscriber) error
Constants ¶
const ( // StatusNew means that newly created session object is written to storage StatusNew = "New" // StatusCompleted means that session object is updated on connection disconnect event StatusCompleted = "Completed" )
const ( // DirectionConsumed marks traffic transaction where node participated as consumer. DirectionConsumed = "Consumed" // DirectionProvided marks traffic transaction where node participated as provider. DirectionProvided = "Provided" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct { StartedFrom *time.Time StartedTo *time.Time Direction *string ConsumerID *identity.Identity HermesID *string ProviderID *identity.Identity ServiceType *string Status *string }
Filter defines all flags for session filtering in session storage.
func (*Filter) SetConsumerID ¶
SetConsumerID filters fetched sessions by consumer.
func (*Filter) SetDirection ¶
SetDirection filters fetched sessions by direction.
func (*Filter) SetHermesID ¶
SetHermesID filters fetched sessions by hermes.
func (*Filter) SetProviderID ¶
SetProviderID filters fetched sessions by provider.
func (*Filter) SetServiceType ¶
SetServiceType filters fetched sessions by service type.
func (*Filter) SetStartedFrom ¶
SetStartedFrom filters fetched sessions from given time.
func (*Filter) SetStartedTo ¶
SetStartedTo filters fetched sessions to given time.
type History ¶
type History struct { SessionID node_session.ID `storm:"id"` Direction string ConsumerID identity.Identity HermesID string ProviderID identity.Identity ServiceType string ConsumerCountry string ProviderCountry string DataSent uint64 DataReceived uint64 Tokens *big.Int IPType string Status string Started time.Time Updated time.Time }
History holds structure for saving session history
func (*History) GetDuration ¶
GetDuration returns delta in seconds (TimeUpdated - TimeStarted)
type Stats ¶
type Stats struct { Count int ConsumerCounts map[identity.Identity]int SumDataSent uint64 SumDataReceived uint64 SumDuration time.Duration SumTokens *big.Int }
Stats holds structure of aggregate session statistics.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage contains functions for storing, getting session objects.
func NewSessionStorage ¶
NewSessionStorage creates session repository with given dependencies.
func (*Storage) StatsByDay ¶
StatsByDay retrieves aggregated statistics grouped by day to Filter.StatsByDay.