adapter

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathDBAdapter

type PathDBAdapter struct {
	// contains filtered or unexported fields
}

PathDBAdapter implements the HiddenPathDB interface. It wraps an implementation of PathDB.

func New

func New(pdb pathdb.PathDB) *PathDBAdapter

New returns a new PathDBAdapter with an implementation of PathDB as backend.

func (*PathDBAdapter) BeginTransaction

func (a *PathDBAdapter) BeginTransaction(ctx context.Context, opts *sql.TxOptions) (
	hiddenpathdb.Transaction, error)

BeginTransaction begins a database read-write transacation

func (*PathDBAdapter) Close

func (a *PathDBAdapter) Close() error

Close closes the backend database

func (PathDBAdapter) Delete

func (rw PathDBAdapter) Delete(ctx context.Context, params *hiddenpathdb.Params) (int, error)

Delete deletes all path segments that match the given query, returning the number of deleted segments

func (PathDBAdapter) DeleteExpired

func (rw PathDBAdapter) DeleteExpired(ctx context.Context, now time.Time) (int, error)

DeleteExpired deletes all hidden path segments that are expired, using now as a reference. Returns the number of deleted segments.

func (PathDBAdapter) Get

func (rw PathDBAdapter) Get(ctx context.Context, params *hiddenpathdb.Params) (query.Results, error)

Get fetches all the hidden path segments matching the given parameters

func (PathDBAdapter) Insert

func (rw PathDBAdapter) Insert(ctx context.Context, seg *seg.Meta,
	ids hiddenpath.GroupIdSet) (pathdb.InsertStats, error)

Insert inserts a hidden path segment into the the underlying PathDB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL