receipts

package
v0.0.0-...-d3d27b2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LevelDBReceiptStoreConf

type LevelDBReceiptStoreConf struct {
	ReceiptStoreConf
	Path string `json:"path"`
}

LevelDBReceiptStoreConf is the configuration for a LevelDB receipt store

type LevelDBReceipts

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

func NewLevelDBReceipts

func NewLevelDBReceipts(conf *LevelDBReceiptStoreConf) (*LevelDBReceipts, error)

func (*LevelDBReceipts) AddReceipt

func (l *LevelDBReceipts) AddReceipt(requestID string, receipt *map[string]interface{}, overwrite bool) (err error)

AddReceipt processes an individual reply message, and contains all errors To account for any transitory failures writing to mongoDB, it retries adding receipt with a backoff

func (*LevelDBReceipts) GetReceipt

func (l *LevelDBReceipts) GetReceipt(requestID string) (*map[string]interface{}, error)

getReply handles a HTTP request for an individual reply

func (*LevelDBReceipts) GetReceipts

func (l *LevelDBReceipts) GetReceipts(skip, limit int, ids []string, sinceEpochMS int64, from, to, start string) (*[]map[string]interface{}, error)

GetReceipts Returns recent receipts with skip, limit and other query parameters

type MemoryReceipts

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

func NewMemoryReceipts

func NewMemoryReceipts(conf *ReceiptStoreConf) *MemoryReceipts

func (*MemoryReceipts) AddReceipt

func (m *MemoryReceipts) AddReceipt(requestID string, receipt *map[string]interface{}, overwrite bool) error

func (*MemoryReceipts) GetReceipt

func (m *MemoryReceipts) GetReceipt(requestID string) (*map[string]interface{}, error)

func (*MemoryReceipts) GetReceipts

func (m *MemoryReceipts) GetReceipts(skip, limit int, ids []string, sinceEpochMS int64, from, to, start string) (*[]map[string]interface{}, error)

func (*MemoryReceipts) Receipts

func (m *MemoryReceipts) Receipts() *list.List

type MongoCollection

type MongoCollection interface {
	Insert(...interface{}) error
	Upsert(query interface{}, doc interface{}) error
	Create(info *mgo.CollectionInfo) error
	EnsureIndex(index mgo.Index) error
	Find(query interface{}) MongoQuery
}

MongoCollection is the subset of mgo that we use, allowing stubbing

type MongoDBReceiptStoreConf

type MongoDBReceiptStoreConf struct {
	ReceiptStoreConf
	URL              string `json:"url"`
	Database         string `json:"database"`
	Collection       string `json:"collection"`
	ConnectTimeoutMS int    `json:"connectTimeout"`
}

MongoDBReceiptStoreConf is the configuration for a MongoDB receipt store

type MongoDatabase

type MongoDatabase interface {
	Connect(url string, timeout time.Duration) error
	GetCollection(database string, collection string) MongoCollection
}

MongoDatabase is a subset of mgo that we use, allowing stubbing.

type MongoQuery

type MongoQuery interface {
	Limit(n int) *mgo.Query
	Skip(n int) *mgo.Query
	Sort(fields ...string) *mgo.Query
	All(result interface{}) error
	One(result interface{}) error
}

MongoQuery is the subset of mgo that we use, allowing stubbing

type MongoReceipts

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

func NewMongoReceipts

func NewMongoReceipts(conf *MongoDBReceiptStoreConf) *MongoReceipts

func (*MongoReceipts) AddReceipt

func (m *MongoReceipts) AddReceipt(requestID string, receipt *map[string]interface{}, overwrite bool) (err error)

AddReceipt processes an individual reply message, and contains all errors To account for any transitory failures writing to mongoDB, it retries adding receipt with a backoff

func (*MongoReceipts) Connect

func (m *MongoReceipts) Connect() (err error)

func (*MongoReceipts) GetReceipt

func (m *MongoReceipts) GetReceipt(requestID string) (*map[string]interface{}, error)

getReply handles a HTTP request for an individual reply

func (*MongoReceipts) GetReceipts

func (m *MongoReceipts) GetReceipts(skip, limit int, ids []string, sinceEpochMS int64, from, to, start string) (*[]map[string]interface{}, error)

GetReceipts Returns recent receipts with skip & limit

type ReceiptStoreConf

type ReceiptStoreConf struct {
	MaxDocs             int `json:"maxDocs"`
	QueryLimit          int `json:"queryLimit"`
	RetryInitialDelayMS int `json:"retryInitialDelay"`
	RetryTimeoutMS      int `json:"retryTimeout"`
}

ReceiptStoreConf is the common configuration for all receipt stores

type ReceiptStorePersistence

type ReceiptStorePersistence interface {
	GetReceipts(skip, limit int, ids []string, sinceEpochMS int64, from, to, start string) (*[]map[string]interface{}, error)
	GetReceipt(requestID string) (*map[string]interface{}, error)
	AddReceipt(requestID string, receipt *map[string]interface{}, overwriteAndRetry bool) error
}

ReceiptStorePersistence interface implemented by persistence layers

Jump to

Keyboard shortcuts

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