bolt

package
v0.0.0-...-2fa03ef Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheKeyNotFound is returned whenever there's a cache miss
	ErrCacheKeyNotFound = errors.New("Cache key not found, cache miss")
)

Functions

func DecodeDBID

func DecodeDBID(dbID []byte) (string, error)

DecodeDBID converts the database ID into the user-visible appraisalID

func EncodeDBID

func EncodeDBID(appraisalID string) ([]byte, error)

EncodeDBID encodes an appraisalID (which is seen by users) into a Unint64 that is used to sort appraisals properly

func EncodeDBIDFromUint64

func EncodeDBIDFromUint64(appraisalID uint64) []byte

EncodeDBIDFromUint64 converts the given uint64 into a byte array for storage. The uint64 is an intermediary form and is only really used when a new appraisalID is generated.

func NewAppraisalDB

func NewAppraisalDB(filename string) (evepraisal.AppraisalDB, error)

NewAppraisalDB returns a new AppraisalDB with the buckets created

func NewPriceDB

func NewPriceDB(filename string) (evepraisal.PriceDB, error)

NewPriceDB returns a new PriceDB instance

func NewTypeDB

func NewTypeDB(filename string, writable bool) (typedb.TypeDB, error)

NewTypeDB returns a new TypeDB

Types

type AppraisalDB

type AppraisalDB struct {
	DB *bolt.DB
	// contains filtered or unexported fields
}

AppraisalDB holds all appraisals

func (*AppraisalDB) Close

func (db *AppraisalDB) Close() error

Close closes the database

func (*AppraisalDB) DeleteAppraisal

func (db *AppraisalDB) DeleteAppraisal(appraisalID string) error

DeleteAppraisal deletes an appraisal by ID

func (*AppraisalDB) GetAppraisal

func (db *AppraisalDB) GetAppraisal(appraisalID string, updateUsedTime bool) (*evepraisal.Appraisal, error)

GetAppraisal returns the given appraisal by ID

func (*AppraisalDB) IncrementTotalAppraisals

func (db *AppraisalDB) IncrementTotalAppraisals() error

IncrementTotalAppraisals will increment to total appraisal count, useful to track non-persistent appraisals

func (*AppraisalDB) LatestAppraisals

func (db *AppraisalDB) LatestAppraisals(reqCount int, kind string) ([]evepraisal.Appraisal, error)

LatestAppraisals returns the global latest appraisals

func (*AppraisalDB) LatestAppraisalsByUser

func (db *AppraisalDB) LatestAppraisalsByUser(user evepraisal.User, reqCount int, kind string, after string) ([]evepraisal.Appraisal, error)

LatestAppraisalsByUser returns the latest appraisals by the given user

func (*AppraisalDB) PutNewAppraisal

func (db *AppraisalDB) PutNewAppraisal(appraisal *evepraisal.Appraisal) error

PutNewAppraisal stores the given appraisal

func (*AppraisalDB) TotalAppraisals

func (db *AppraisalDB) TotalAppraisals() (int64, error)

TotalAppraisals returns the number of total appraisals

type HTTPCache

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

HTTPCache caches HTTP responses and adheres to the interface in github.com/gregjones/httpcache

func NewHTTPCache

func NewHTTPCache(filename string) (*HTTPCache, error)

NewHTTPCache makes a new boltdb-based HTTPCache object

func (*HTTPCache) Close

func (c *HTTPCache) Close() error

Close cleans up any open boltdb connections

func (*HTTPCache) Delete

func (c *HTTPCache) Delete(key string)

Delete deletes a cache entry and logs on failure

func (*HTTPCache) Get

func (c *HTTPCache) Get(key string) (resp []byte, ok bool)

Get retreives a cache entry, if it exists

func (*HTTPCache) Set

func (c *HTTPCache) Set(key string, resp []byte)

Set creates a new cache entry and logs on failure

type PriceDB

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

PriceDB stores the market prices for items

func (*PriceDB) Close

func (db *PriceDB) Close() error

Close cleans up the PriceDB

func (*PriceDB) GetPrice

func (db *PriceDB) GetPrice(market string, typeID int64) (evepraisal.Prices, bool)

GetPrice returns the price for a type given a market name and typeID

func (*PriceDB) UpdatePrices

func (db *PriceDB) UpdatePrices(items []evepraisal.MarketItemPrices) error

UpdatePrices updates the price for the given typeID in the given market

type TypeDB

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

TypeDB holds all EveTypes

func (*TypeDB) Close

func (db *TypeDB) Close() error

Close will close the type database

func (*TypeDB) Delete

func (db *TypeDB) Delete() error

Delete will delete the entire type DB

func (*TypeDB) GetType

func (db *TypeDB) GetType(typeName string) (typedb.EveType, bool)

GetType returns the EveType given a name

func (*TypeDB) GetTypeByID

func (db *TypeDB) GetTypeByID(typeID int64) (typedb.EveType, bool)

GetTypeByID returns the EveType that matches the integer ID

func (*TypeDB) HasType

func (db *TypeDB) HasType(typeName string) bool

HasType returns whether or not the type exists given a name

func (*TypeDB) ListTypes

func (db *TypeDB) ListTypes(startingTypeID int64, limit int64) ([]typedb.EveType, error)

ListTypes returns all the types

func (*TypeDB) PutTypes

func (db *TypeDB) PutTypes(eveTypes []typedb.EveType) error

PutTypes will insert/update the given EveTypes

func (*TypeDB) Search

func (db *TypeDB) Search(s string) []typedb.EveType

Search allows for searching based on an incomplete name of a type

Jump to

Keyboard shortcuts

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