db

package
v0.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2017 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SettingsNotSetError error = errors.New("Settings not set")

Functions

func Decrypt

func Decrypt() error

Create a temp database, read the encrypted database into it then replace the encrypted database

func Encrypt

func Encrypt() error

Create a temp encrypted database, read the unencrypted database into it then replace the unencrypted database

Types

type CasesDB added in v0.3.0

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

func (*CasesDB) Count added in v0.6.0

func (c *CasesDB) Count() int

func (*CasesDB) Delete added in v0.3.0

func (c *CasesDB) Delete(orderID string) error

func (*CasesDB) GetAll added in v0.3.0

func (c *CasesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Case, int, error)

func (*CasesDB) GetCaseMetadata added in v0.3.0

func (c *CasesDB) GetCaseMetadata(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerValidationErrors, vendorValidationErrors []string, state pb.OrderState, read bool, timestamp time.Time, buyerOpened bool, claim string, resolution *pb.DisputeResolution, err error)

func (*CasesDB) GetPayoutDetails added in v0.3.0

func (c *CasesDB) GetPayoutDetails(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerPayoutAddress, vendorPayoutAddress string, buyerOutpoints, vendorOutpoints []*pb.Outpoint, state pb.OrderState, err error)

func (*CasesDB) MarkAsClosed added in v0.3.0

func (c *CasesDB) MarkAsClosed(caseID string, resolution *pb.DisputeResolution) error

func (*CasesDB) MarkAsRead added in v0.3.0

func (c *CasesDB) MarkAsRead(orderID string) error

func (*CasesDB) MarkAsUnread added in v0.6.1

func (c *CasesDB) MarkAsUnread(orderID string) error

func (*CasesDB) Put added in v0.3.0

func (c *CasesDB) Put(caseID string, state pb.OrderState, buyerOpened bool, claim string) error

func (*CasesDB) UpdateBuyerInfo added in v0.3.0

func (c *CasesDB) UpdateBuyerInfo(caseID string, buyerContract *pb.RicardianContract, buyerValidationErrors []string, buyerPayoutAddress string, buyerOutpoints []*pb.Outpoint) error

func (*CasesDB) UpdateVendorInfo added in v0.3.0

func (c *CasesDB) UpdateVendorInfo(caseID string, vendorContract *pb.RicardianContract, vendorValidationErrors []string, vendorPayoutAddress string, vendorOutpoints []*pb.Outpoint) error

type ChatDB added in v0.3.1

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

func (*ChatDB) DeleteConversation added in v0.3.1

func (c *ChatDB) DeleteConversation(peerId string) error

func (*ChatDB) DeleteMessage added in v0.3.1

func (c *ChatDB) DeleteMessage(msgID string) error

func (*ChatDB) GetConversations added in v0.3.1

func (c *ChatDB) GetConversations() []repo.ChatConversation

func (*ChatDB) GetMessages added in v0.3.1

func (c *ChatDB) GetMessages(peerID string, subject string, offsetId string, limit int) []repo.ChatMessage

func (*ChatDB) GetUnreadCount added in v0.5.1

func (c *ChatDB) GetUnreadCount(subject string) (int, error)

func (*ChatDB) MarkAsRead added in v0.3.1

func (c *ChatDB) MarkAsRead(peerID string, subject string, outgoing bool, messageId string) (string, bool, error)

func (*ChatDB) Put added in v0.3.1

func (c *ChatDB) Put(messageId string, peerId string, subject string, message string, timestamp time.Time, read bool, outgoing bool) error

type ConfigDB

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

func (*ConfigDB) GetCreationDate added in v0.6.4

func (c *ConfigDB) GetCreationDate() (time.Time, error)

func (*ConfigDB) GetIdentityKey

func (c *ConfigDB) GetIdentityKey() ([]byte, error)

func (*ConfigDB) GetMnemonic

func (c *ConfigDB) GetMnemonic() (string, error)

func (*ConfigDB) Init

func (c *ConfigDB) Init(mnemonic string, identityKey []byte, password string, creationDate time.Time) error

func (*ConfigDB) IsEncrypted

func (c *ConfigDB) IsEncrypted() bool

type CouponDB added in v0.5.0

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

func (*CouponDB) Delete added in v0.5.0

func (c *CouponDB) Delete(slug string) error

func (*CouponDB) Get added in v0.5.0

func (c *CouponDB) Get(slug string) ([]repo.Coupon, error)

func (*CouponDB) Put added in v0.5.0

func (c *CouponDB) Put(coupons []repo.Coupon) error

type FollowerDB

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

func (*FollowerDB) Count

func (f *FollowerDB) Count() int

func (*FollowerDB) Delete

func (f *FollowerDB) Delete(follower string) error

func (*FollowerDB) FollowsMe added in v0.2.0

func (f *FollowerDB) FollowsMe(peerId string) bool

func (*FollowerDB) Get

func (f *FollowerDB) Get(offsetId string, limit int) ([]repo.Follower, error)

func (*FollowerDB) Put

func (f *FollowerDB) Put(follower string, proof []byte) error

type FollowingDB

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

func (*FollowingDB) Count

func (f *FollowingDB) Count() int

func (*FollowingDB) Delete

func (f *FollowingDB) Delete(follower string) error

func (*FollowingDB) Get

func (f *FollowingDB) Get(offsetId string, limit int) ([]string, error)

func (*FollowingDB) IsFollowing added in v0.2.0

func (f *FollowingDB) IsFollowing(peerId string) bool

func (*FollowingDB) Put

func (f *FollowingDB) Put(follower string) error

type InventoryDB

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

func (*InventoryDB) Delete

func (i *InventoryDB) Delete(slug string, variantIndex int) error

func (*InventoryDB) DeleteAll added in v0.1.1

func (i *InventoryDB) DeleteAll(slug string) error

func (*InventoryDB) Get

func (i *InventoryDB) Get(slug string) (map[int]int, error)

func (*InventoryDB) GetAll

func (i *InventoryDB) GetAll() (map[string]map[int]int, error)

func (*InventoryDB) GetSpecific added in v0.1.1

func (i *InventoryDB) GetSpecific(slug string, variantIndex int) (int, error)

func (*InventoryDB) Put

func (i *InventoryDB) Put(slug string, variantIndex int, count int) error

type KeysDB

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

func (*KeysDB) GetAll

func (k *KeysDB) GetAll() ([]wallet.KeyPath, error)

func (*KeysDB) GetImported added in v0.9.2

func (k *KeysDB) GetImported() ([]*btcec.PrivateKey, error)

func (*KeysDB) GetKey added in v0.7.0

func (k *KeysDB) GetKey(scriptAddress []byte) (*btcec.PrivateKey, error)

func (*KeysDB) GetLastKeyIndex

func (k *KeysDB) GetLastKeyIndex(purpose wallet.KeyPurpose) (int, bool, error)

func (*KeysDB) GetLookaheadWindows

func (k *KeysDB) GetLookaheadWindows() map[wallet.KeyPurpose]int

func (*KeysDB) GetPathForKey added in v0.7.0

func (k *KeysDB) GetPathForKey(scriptAddress []byte) (wallet.KeyPath, error)

func (*KeysDB) GetUnused

func (k *KeysDB) GetUnused(purpose wallet.KeyPurpose) ([]int, error)

func (*KeysDB) ImportKey added in v0.4.2

func (k *KeysDB) ImportKey(scriptAddress []byte, key *btcec.PrivateKey) error

func (*KeysDB) MarkKeyAsUsed

func (k *KeysDB) MarkKeyAsUsed(scriptAddress []byte) error

func (*KeysDB) Put

func (k *KeysDB) Put(scriptAddress []byte, keyPath wallet.KeyPath) error

type ModeratedDB added in v0.5.1

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

func (*ModeratedDB) Delete added in v0.5.1

func (m *ModeratedDB) Delete(follower string) error

func (*ModeratedDB) Get added in v0.5.1

func (m *ModeratedDB) Get(offsetId string, limit int) ([]string, error)

func (*ModeratedDB) Put added in v0.5.1

func (m *ModeratedDB) Put(peerId string) error

type NotficationsDB added in v0.3.1

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

func (*NotficationsDB) Delete added in v0.3.1

func (n *NotficationsDB) Delete(notifID string) error

func (*NotficationsDB) GetAll added in v0.3.1

func (n *NotficationsDB) GetAll(offsetId string, limit int, typeFilter []string) ([]notif.Notification, int, error)

func (*NotficationsDB) GetUnreadCount added in v0.5.6

func (n *NotficationsDB) GetUnreadCount() (int, error)

func (*NotficationsDB) MarkAllAsRead added in v0.6.4

func (n *NotficationsDB) MarkAllAsRead() error

func (*NotficationsDB) MarkAsRead added in v0.3.1

func (n *NotficationsDB) MarkAsRead(notifID string) error

func (*NotficationsDB) Put added in v0.3.1

func (n *NotficationsDB) Put(notifID string, notification notif.Data, notifType string, timestamp time.Time) error

type OfflineMessagesDB

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

func (*OfflineMessagesDB) DeleteMessage added in v0.6.3

func (o *OfflineMessagesDB) DeleteMessage(url string) error

func (*OfflineMessagesDB) GetMessages added in v0.6.3

func (o *OfflineMessagesDB) GetMessages() (map[string][]byte, error)

func (*OfflineMessagesDB) Has

func (o *OfflineMessagesDB) Has(url string) bool

func (*OfflineMessagesDB) Put

func (o *OfflineMessagesDB) Put(url string) error

func (*OfflineMessagesDB) SetMessage added in v0.6.3

func (o *OfflineMessagesDB) SetMessage(url string, message []byte) error

type PointersDB

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

func (*PointersDB) Delete

func (p *PointersDB) Delete(id peer.ID) error

func (*PointersDB) DeleteAll added in v0.1.1

func (p *PointersDB) DeleteAll(purpose ipfs.Purpose) error

func (*PointersDB) Get added in v0.5.0

func (p *PointersDB) Get(id peer.ID) (ipfs.Pointer, error)

func (*PointersDB) GetAll

func (p *PointersDB) GetAll() ([]ipfs.Pointer, error)

func (*PointersDB) GetByPurpose added in v0.5.3

func (p *PointersDB) GetByPurpose(purpose ipfs.Purpose) ([]ipfs.Pointer, error)

func (*PointersDB) Put

func (p *PointersDB) Put(pointer ipfs.Pointer) error

type PurchasesDB added in v0.1.2

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

func (*PurchasesDB) Count added in v0.6.0

func (p *PurchasesDB) Count() int

func (*PurchasesDB) Delete added in v0.1.2

func (p *PurchasesDB) Delete(orderID string) error

func (*PurchasesDB) GetAll added in v0.1.2

func (p *PurchasesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Purchase, int, error)

func (*PurchasesDB) GetByOrderId added in v0.2.0

func (p *PurchasesDB) GetByOrderId(orderId string) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, bool, error)

func (*PurchasesDB) GetByPaymentAddress added in v0.2.0

func (p *PurchasesDB) GetByPaymentAddress(addr btc.Address) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, error)

func (*PurchasesDB) MarkAsRead added in v0.1.2

func (p *PurchasesDB) MarkAsRead(orderID string) error

func (*PurchasesDB) MarkAsUnread added in v0.6.1

func (p *PurchasesDB) MarkAsUnread(orderID string) error

func (*PurchasesDB) Put added in v0.1.2

func (p *PurchasesDB) Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

func (*PurchasesDB) UpdateFunding added in v0.2.0

func (p *PurchasesDB) UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error

type SQLiteDatastore

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

func Create

func Create(repoPath, password string, testnet bool) (*SQLiteDatastore, error)

func (*SQLiteDatastore) Cases added in v0.3.0

func (d *SQLiteDatastore) Cases() repo.Cases

func (*SQLiteDatastore) Chat added in v0.3.1

func (d *SQLiteDatastore) Chat() repo.Chat

func (*SQLiteDatastore) Close

func (d *SQLiteDatastore) Close()

func (*SQLiteDatastore) Config

func (d *SQLiteDatastore) Config() repo.Config

func (*SQLiteDatastore) Copy

func (d *SQLiteDatastore) Copy(dbPath string, password string) error

func (*SQLiteDatastore) Coupons added in v0.5.0

func (d *SQLiteDatastore) Coupons() repo.Coupons

func (*SQLiteDatastore) Followers

func (d *SQLiteDatastore) Followers() repo.Followers

func (*SQLiteDatastore) Following

func (d *SQLiteDatastore) Following() repo.Following

func (*SQLiteDatastore) Inventory

func (d *SQLiteDatastore) Inventory() repo.Inventory

func (*SQLiteDatastore) Keys

func (d *SQLiteDatastore) Keys() wallet.Keys

func (*SQLiteDatastore) ModeratedStores added in v0.5.1

func (d *SQLiteDatastore) ModeratedStores() repo.ModeratedStores

func (*SQLiteDatastore) Notifications added in v0.3.1

func (d *SQLiteDatastore) Notifications() repo.Notifications

func (*SQLiteDatastore) OfflineMessages

func (d *SQLiteDatastore) OfflineMessages() repo.OfflineMessages

func (*SQLiteDatastore) Ping added in v0.7.0

func (d *SQLiteDatastore) Ping() error

func (*SQLiteDatastore) Pointers

func (d *SQLiteDatastore) Pointers() repo.Pointers

func (*SQLiteDatastore) Purchases added in v0.1.2

func (d *SQLiteDatastore) Purchases() repo.Purchases

func (*SQLiteDatastore) Sales added in v0.1.2

func (d *SQLiteDatastore) Sales() repo.Sales

func (*SQLiteDatastore) Settings

func (d *SQLiteDatastore) Settings() repo.Settings

func (*SQLiteDatastore) Stxos

func (d *SQLiteDatastore) Stxos() wallet.Stxos

func (*SQLiteDatastore) TxMetadata added in v0.5.1

func (d *SQLiteDatastore) TxMetadata() repo.TxMetadata

func (*SQLiteDatastore) Txns

func (d *SQLiteDatastore) Txns() wallet.Txns

func (*SQLiteDatastore) Utxos

func (d *SQLiteDatastore) Utxos() wallet.Utxos

func (*SQLiteDatastore) WatchedScripts added in v0.2.0

func (d *SQLiteDatastore) WatchedScripts() wallet.WatchedScripts

type SalesDB added in v0.1.2

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

func (*SalesDB) Count added in v0.6.0

func (s *SalesDB) Count() int

func (*SalesDB) Delete added in v0.1.2

func (s *SalesDB) Delete(orderID string) error

func (*SalesDB) GetAll added in v0.1.2

func (s *SalesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Sale, int, error)

func (*SalesDB) GetByOrderId added in v0.2.0

func (s *SalesDB) GetByOrderId(orderId string) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, bool, error)

func (*SalesDB) GetByPaymentAddress added in v0.2.0

func (s *SalesDB) GetByPaymentAddress(addr btc.Address) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, error)

func (*SalesDB) MarkAsRead added in v0.1.2

func (s *SalesDB) MarkAsRead(orderID string) error

func (*SalesDB) MarkAsUnread added in v0.6.1

func (s *SalesDB) MarkAsUnread(orderID string) error

func (*SalesDB) Put added in v0.1.2

func (s *SalesDB) Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

func (*SalesDB) UpdateFunding added in v0.2.0

func (s *SalesDB) UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error

type SettingsDB

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

func (*SettingsDB) Delete added in v0.2.4

func (s *SettingsDB) Delete() error

Delete removes all settings from the database. It's a destructive action that should be used with care.

func (*SettingsDB) Get

func (s *SettingsDB) Get() (repo.SettingsData, error)

func (*SettingsDB) Put

func (s *SettingsDB) Put(settings repo.SettingsData) error

func (*SettingsDB) Update

func (s *SettingsDB) Update(settings repo.SettingsData) error

type StxoDB

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

func (*StxoDB) Delete

func (s *StxoDB) Delete(stxo wallet.Stxo) error

func (*StxoDB) GetAll

func (s *StxoDB) GetAll() ([]wallet.Stxo, error)

func (*StxoDB) Put

func (s *StxoDB) Put(stxo wallet.Stxo) error

type TxMetadataDB added in v0.5.1

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

func (*TxMetadataDB) Delete added in v0.5.1

func (t *TxMetadataDB) Delete(txid string) error

func (*TxMetadataDB) Get added in v0.5.1

func (t *TxMetadataDB) Get(txid string) (repo.Metadata, error)

func (*TxMetadataDB) GetAll added in v0.5.1

func (t *TxMetadataDB) GetAll() (map[string]repo.Metadata, error)

func (*TxMetadataDB) Put added in v0.5.1

func (t *TxMetadataDB) Put(m repo.Metadata) error

type TxnsDB

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

func (*TxnsDB) Delete

func (t *TxnsDB) Delete(txid *chainhash.Hash) error

func (*TxnsDB) Get

func (t *TxnsDB) Get(txid chainhash.Hash) (*wire.MsgTx, wallet.Txn, error)

func (*TxnsDB) GetAll

func (t *TxnsDB) GetAll(includeWatchOnly bool) ([]wallet.Txn, error)

func (*TxnsDB) Put

func (t *TxnsDB) Put(txn *wire.MsgTx, value, height int, timestamp time.Time, watchOnly bool) error

func (*TxnsDB) UpdateHeight added in v0.5.4

func (t *TxnsDB) UpdateHeight(txid chainhash.Hash, height int) error

type UtxoDB

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

func (*UtxoDB) Delete

func (u *UtxoDB) Delete(utxo wallet.Utxo) error

func (*UtxoDB) GetAll

func (u *UtxoDB) GetAll() ([]wallet.Utxo, error)

func (*UtxoDB) Put

func (u *UtxoDB) Put(utxo wallet.Utxo) error

func (*UtxoDB) SetWatchOnly added in v0.5.3

func (u *UtxoDB) SetWatchOnly(utxo wallet.Utxo) error

type WatchedScriptsDB added in v0.2.0

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

func (*WatchedScriptsDB) Delete added in v0.2.0

func (w *WatchedScriptsDB) Delete(scriptPubKey []byte) error

func (*WatchedScriptsDB) GetAll added in v0.2.0

func (w *WatchedScriptsDB) GetAll() ([][]byte, error)

func (*WatchedScriptsDB) Put added in v0.2.0

func (w *WatchedScriptsDB) Put(scriptPubKey []byte) error

Jump to

Keyboard shortcuts

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