Documentation ¶
Index ¶
- Constants
- Variables
- func Reset()
- func SetClient(newClient *ensign.Client)
- func Start(conf Config) (err error)
- func Stop()
- type Activity
- type ActivityCount
- type Config
- type Entry
- type Network
- type NetworkActivity
- func (a *NetworkActivity) Event() (_ *ensign.Event, err error)
- func (a *NetworkActivity) Incr(activity Activity)
- func (a *NetworkActivity) IncrVASP(vaspID string, activity Activity)
- func (a *NetworkActivity) Reset()
- func (a *NetworkActivity) WindowEnd() time.Time
- func (a *NetworkActivity) WindowStart() time.Time
Constants ¶
const (
NetworkActivityMimeType = mimetype.ApplicationMsgPack
)
Variables ¶
var ( ErrMissingTopic = errors.New("missing activity topic") ErrInvalidWindow = errors.New("aggregation window must be greater than 0") ErrUnknownNetwork = errors.New("unknown network, expected testnet, mainnet, or rvasp") )
var NetworkActivityEventType = api.Type{
Name: "NetworkActivity",
MajorVersion: 1,
}
Functions ¶
func Reset ¶
func Reset()
Reset the publisher to allow NewPublisher() to be called again, this method should only be used for testing.
func SetClient ¶
func SetClient(newClient *ensign.Client)
Set an Ensign client for testing purposes.
Types ¶
type ActivityCount ¶
type Config ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entries are created from external go routines and are eventually published as Events to Ensign by the activity publisher.
func KeyExchange ¶
func KeyExchange() *Entry
KeyExchange creates a new activity entry for fetching a signing key. Must call Add() to commit the entry.
func Lookup ¶
func Lookup() *Entry
Lookup creates a new activity entry for a lookup. Must call Add() to commit the entry.
func Register ¶
func Register() *Entry
Register creates a new activity entry for registering a VASP. Must call Add() to commit the entry.
type NetworkActivity ¶
type NetworkActivity struct { Network Network `msgpack:"network"` // The network refers to TestNet or MainNet and possibly also rVASP Activity ActivityCount `msgpack:"activity"` // A count of activity events by name VASPActivity map[string]ActivityCount `msgpack:"vasp_activity"` // Per-vasp activity count should be less than or equal to activity counts Timestamp time.Time `msgpack:"timestamp"` // The start time of the aggregation window Window time.Duration `msgpack:"window"` // The window size of the aggregation window }
NetworkActivity represents a time-aggregated collection of events on the GDS or rVASP that are a proxy for TRISA transfer usage; e.g. GDS lookups or rVSAP transfers. This event is published as msgpack data to an Ensign topic so that the BFF can render a timeseries of network activity.
func Parse ¶
func Parse(event *ensign.Event) (_ *NetworkActivity, err error)
func (*NetworkActivity) Event ¶
func (a *NetworkActivity) Event() (_ *ensign.Event, err error)
func (*NetworkActivity) Incr ¶
func (a *NetworkActivity) Incr(activity Activity)
func (*NetworkActivity) IncrVASP ¶
func (a *NetworkActivity) IncrVASP(vaspID string, activity Activity)
func (*NetworkActivity) Reset ¶
func (a *NetworkActivity) Reset()
Reset the activity counts to zero in preparation for a new aggregation window.
func (*NetworkActivity) WindowEnd ¶
func (a *NetworkActivity) WindowEnd() time.Time
func (*NetworkActivity) WindowStart ¶
func (a *NetworkActivity) WindowStart() time.Time