Documentation
¶
Overview ¶
Package state persists private accepted state and a bounded acknowledged traffic journal.
Index ¶
- Constants
- func AtomicWrite(path string, b []byte, mode os.FileMode) error
- func ID() string
- type Batch
- type Data
- type Store
- func (s *Store) Accept(c protocol.Config, revision uint64) error
- func (s *Store) Ack(id string) error
- func (s *Store) AddAccounting(delta Traffic, samples []protocol.TrafficSample) error
- func (s *Store) AddTraffic(delta Traffic) error
- func (s *Store) Authorize(users []protocol.User, revision uint64) error
- func (s *Store) Ban(id int, until time.Time) error
- func (s *Store) Batch() (*Batch, error)
- func (s *Store) BlockIP(key string, block protocol.IPBlock) error
- func (s *Store) Flush() (protocol.TrafficBarrier, error)
- func (s *Store) Snapshot() Data
- type Traffic
Constants ¶
View Source
const MaxStoreBytes = 64 << 20
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Batch ¶
type Batch = protocol.TrafficReport
type Data ¶
type Data struct {
AgentID string `json:"agent_id"`
Revision uint64 `json:"revision"`
ConfigRevision uint64 `json:"config_revision"`
Config *protocol.Config `json:"config,omitempty"`
Users []protocol.User `json:"users"`
Bans map[int]time.Time `json:"bans,omitempty"`
IPBlocks map[string]protocol.IPBlock `json:"ip_blocks,omitempty"`
Sequence uint64 `json:"sequence"`
Pending *Batch `json:"pending,omitempty"`
Accumulated Traffic `json:"accumulated,omitempty"`
Accounting map[string]protocol.TrafficSample `json:"accounting,omitempty"`
Backlog []*Batch `json:"backlog,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Ack ¶
Ack retires only the matching head and advances queued barrier batches in order.
func (*Store) AddAccounting ¶ added in v1.0.2
func (s *Store) AddAccounting(delta Traffic, samples []protocol.TrafficSample) error
AddAccounting commits legacy totals and period samples in one durable mutation.
func (*Store) AddTraffic ¶
Click to show internal directories.
Click to hide internal directories.