repo

package
v0.0.0-...-7bc409f Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBootstrapAddresses = []string{
	"/ip4/107.170.133.32/tcp/4001/ipfs/QmboEn7ycZqb8sXH6wJunWE6d3mdT9iVD7XWDmCcKE9jZ5",
	"/ip4/139.59.174.197/tcp/4001/ipfs/QmWPRBSdhmhfWLUZapvfg6GCuyYyscgPnaKycYfWqJJcdB",
	"/ip4/139.59.6.222/tcp/4001/ipfs/QmVW1nDx2rt8eff8nAB3L8MannsHFsidje6YC3EQvhcwZF",
}
View Source
var ErrRepoExists = errors.New(`ipfs configuration file already exists!
Reinitializing would overwrite your keys.
(use -f to force overwrite)
`)

Functions

func DoInit

func DoInit(out io.Writer, repoRoot string, nBitsForKeypair int, testnet bool, password string, dbInit func(string, []byte, string) error) error

func GetDefaultFees

func GetDefaultFees(cfgPath string) (Low uint64, Medium uint64, High uint64, err error)

func GetDropboxApiToken

func GetDropboxApiToken(cfgPath string) (string, error)

func GetFeeAPI

func GetFeeAPI(cfgPath string) (string, error)

func GetLibbitcoinServers

func GetLibbitcoinServers(cfgPath string) ([]libbitcoin.Server, error)

func GetMaxFee

func GetMaxFee(cfgPath string) (uint64, error)

Types

type Coins

type Coins interface {
	// Put a new coin (utxo) to the database
	Put(bitcoin.Utxo) error

	// Does the outpoint exist in the database?
	Has(txid []byte, index int) bool

	// Remove a coin from the database
	Delete(txid []byte, index int) error

	// Fetch all coins from the db
	// Useful for coin selection
	GetAll() []bitcoin.Utxo

	// Get the value associated with a utxo
	GetValue(txid []byte, index int) (int, error)
}

type Config

type Config interface {
	// Initialize the database with the node's mnemonic seed and
	// identity key. This will be called during repo init
	Init(mnemonic string, identityKey []byte, password string) error

	// Return the mnemonic string
	GetMnemonic() (string, error)

	// Return the identity key
	GetIdentityKey() ([]byte, error)

	// Returns true if the db has failed to decrypt properly ex) wrong pw
	IsEncrypted() bool
}

type Datastore

type Datastore interface {
	Config() Config
	Followers() Followers
	Following() Following
	OfflineMessages() OfflineMessages
	Pointers() Pointers
	Keys() Keys
	Transactions() Transactions
	Coins() Coins
	Close()
}

type Followers

type Followers interface {
	// Put a B58 encoded follower ID to the database
	Put(follower string) error

	// Get followers from the database.
	// The offset and limit arguments can be used to for lazy loading.
	Get(offset int, limit int) ([]string, error)

	// Delete a follower from the databse.
	Delete(follower string) error

	// Return the number of followers in the database.
	Count() int
}

type Following

type Following interface {
	// Put a B58 encoded peer ID to the database
	Put(peer string) error

	// Get a list of following peers from the database.
	// The offset and limit arguments can be used to for lazy loading.
	Get(offset int, limit int) ([]string, error)

	// Delete a peer from the databse.
	Delete(peer string) error

	// Return the number of peers in the database.
	Count() int
}

type Keys

type Keys interface {
	// Put a bip32 key to the database
	Put(key *b32.Key, scriptPubKey []byte, purpose bitcoin.KeyPurpose) error

	// Mark the given key as used
	MarkKeyAsUsed(key *b32.Key) error

	// Fetch the key at the last index for the given purpose
	// The bool should state whether the key has been used or not
	GetLastKey(purpose bitcoin.KeyPurpose) (*b32.Key, bool, error)

	// Given a scriptPubKey return the corresponding bip32 key
	GetKeyForScript(scriptPubKey []byte) (*b32.Key, error)

	// Fetch all keys
	GetAll() ([]*b32.Key, error)
}

type OfflineMessages

type OfflineMessages interface {
	// Put a url from a retrieved message
	Put(url string) error

	// Does the given url exist in the db?
	Has(url string) bool
}

type Pointers

type Pointers interface {
	// Put a pointer to the database.
	Put(p ipfs.Pointer) error

	// Delete a pointer from the db.
	Delete(id peer.ID) error

	// Fetch the entire list of pointers
	GetAll() ([]ipfs.Pointer, error)
}

type Transactions

type Transactions interface {
	// Put a new transaction to the database
	Put(txinfo bitcoin.TransactionInfo) error

	// Does the transaction already exist in the database?
	Has(txid []byte) bool

	// Fetch all transactions
	GetAll() []bitcoin.TransactionInfo

	// Fetch unconfirmed transactions
	GetUnconfirmed() []bitcoin.TransactionInfo

	// Fetch the height of a tx
	GetHeight(txid []byte) (int, error)

	// Update the transaction state
	UpdateState(txid []byte, state bitcoin.TransactionState) error

	// Update the transaction height. This should only be needed
	// for newly confirmed transactions and reorgs.
	UpdateHeight(txid []byte, height int) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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