Documentation
¶
Overview ¶
Package store defines the request pool's persistence boundary and provides a transactional Bolt implementation. Applications can implement Store to keep inventory in an existing database.
Index ¶
- type Bolt
- func (s *Bolt) Close() error
- func (s *Bolt) LoadProxies(ctx context.Context) (Inventory, error)
- func (s *Bolt) Path() string
- func (s *Bolt) SaveProxies(ctx context.Context, rows []Record, sources []Source, first json.RawMessage, ...) error
- func (s *Bolt) SaveProxy(ctx context.Context, row Record, first json.RawMessage) error
- type Inventory
- type Record
- type Source
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bolt ¶
type Bolt struct {
// contains filtered or unexported fields
}
Bolt is a durable, single-process inventory store. Other processes cannot open the same file while it is in use. Opening a locked file fails after one second. Files are created with mode 0600 because endpoints may hold secrets.
func (*Bolt) LoadProxies ¶
LoadProxies reads an independent inventory snapshot, retaining exploration order.
type Inventory ¶
type Inventory struct {
Rows []json.RawMessage
Sources []Source
First json.RawMessage
Retired map[string]float64
Imported bool
}
Inventory is an ordered snapshot. First contains learned selection priors. Imported records whether an opted-in legacy import has already run.
type Record ¶
type Record struct {
URL string
Data json.RawMessage
}
Record is an endpoint's complete scored state, encoded as JSON by the pool.
type Source ¶
type Source struct {
URL string
Scope string
Data json.RawMessage
}
Source is a discovery feed's last listing for an optional scope.
type Store ¶
type Store interface {
LoadProxies(context.Context) (Inventory, error)
SaveProxy(context.Context, Record, json.RawMessage) error
SaveProxies(context.Context, []Record, []Source, json.RawMessage, map[string]float64) error
Path() string
Close() error
}
Store persists complete outcomes atomically with their learned priors. SaveProxies replaces the inventory, preserving the supplied row order. Implementations must not retain mutable references to supplied data.