Documentation ¶
Index ¶
- Constants
- type Backend
- func (b *Backend) Close() error
- func (e Backend) DeleteExpiredLevel1Keys(ctx context.Context, cutoff time.Time) (int, error)
- func (e Backend) GetLevel1Key(ctx context.Context, meta drkey.Level1Meta) (drkey.Level1Key, error)
- func (e Backend) InsertLevel1Key(ctx context.Context, key drkey.Level1Key) error
- func (b *Backend) SetMaxIdleConns(maxIdleConns int)
- func (b *Backend) SetMaxOpenConns(maxOpenConns int)
Constants ¶
View Source
const ( // Level1SchemaVersion 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. Level1SchemaVersion = 1 // Level1Schema is the SQLite database layout. Level1Schema = `` /* 339-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Level1Backend implements a level 1 drkey DB with sqlite.
func NewBackend ¶
NewLevel1Backend creates a database and prepares all statements.
func (Backend) DeleteExpiredLevel1Keys ¶
DeleteExpiredLevel1Keys removes all expired Level1 key, i.e. all the keys which expiration time is strictly smaller than the cutoff
func (Backend) GetLevel1Key ¶
func (e Backend) GetLevel1Key( ctx context.Context, meta drkey.Level1Meta, ) (drkey.Level1Key, error)
GetLevel1Key takes metadata information for the Level1 key and a timestamp at which it should be valid and returns the corresponding Level1Key.
func (Backend) InsertLevel1Key ¶
InsertLevel1Key inserts a Level1 key.
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.