Documentation ¶
Index ¶
- Constants
- type Backend
- func (e Backend) BeaconSources(ctx context.Context) ([]addr.IA, error)
- func (e Backend) CandidateBeacons(ctx context.Context, setSize int, usage beacon.Usage, src addr.IA) ([]beacon.Beacon, error)
- func (b *Backend) Close() error
- func (e Backend) DeleteExpiredBeacons(ctx context.Context, now time.Time) (int, error)
- func (e Backend) GetBeacons(ctx context.Context, params *storagebeacon.QueryParams) ([]storagebeacon.Beacon, error)
- func (e Backend) InsertBeacon(ctx context.Context, b beacon.Beacon, usage beacon.Usage) (beacon.InsertStats, error)
- func (b *Backend) SetMaxIdleConns(maxIdleConns int)
- func (b *Backend) SetMaxOpenConns(maxOpenConns int)
Constants ¶
View Source
const ( // SchemaVersion is the version of the SQLite schema understood by this backend. // Whenever changes to the schema are made, this version number should be increased // to prevent data corruption between incompatible database schemas. SchemaVersion = 1 // Schema is the SQLite database layout. Schema = `` /* 379-byte string literal not displayed */ BeaconsTable = "Beacons" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new SQLite backend opening a database at the given path. If no database exists a new database is be created. If the schema version of the stored database is different from the one in schema.go, an error is returned.
func (Backend) BeaconSources ¶
func (Backend) CandidateBeacons ¶
func (Backend) DeleteExpiredBeacons ¶
func (Backend) GetBeacons ¶
func (e Backend) GetBeacons( ctx context.Context, params *storagebeacon.QueryParams, ) ([]storagebeacon.Beacon, error)
func (Backend) InsertBeacon ¶
func (e Backend) InsertBeacon( ctx context.Context, b beacon.Beacon, usage beacon.Usage, ) (beacon.InsertStats, error)
InsertBeacon inserts the beacon if it is new or updates the changed information.
func (*Backend) SetMaxIdleConns ¶
SetMaxIdleConns sets the maximum number of idle connections.
func (*Backend) SetMaxOpenConns ¶
SetMaxOpenConns sets the maximum number of open connections.
Click to show internal directories.
Click to hide internal directories.