repo

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBootstrapAddresses = []string{
	"/ip4/107.170.133.32/tcp/4001/ipfs/QmSwHSqtUi9GhHTegi8gA5n2fsjP7LcnxGQeedj8ScLi8q",
	"/ip4/139.59.174.197/tcp/4001/ipfs/Qmf6ZASu56X3iS9zBh5CQRDCLHttDY41637qn87gzSGybs",
	"/ip4/139.59.6.222/tcp/4001/ipfs/QmZAZYJ5MvqkdoTuaFaoeyHkHLd8muENfr9JTo7ikQZPSG",
	"/ip4/46.101.198.170/tcp/4001/ipfs/QmaFo4VkBSASyjejkXB7ZMKTPW3sJNQBCR1apXMEdz7xAr",
}
View Source
var ErrRepoExists = errors.New("IPFS configuration file exists. Reinitializing would overwrite your keys. Use -f to force overwrite.")

Functions

func DoInit

func DoInit(repoRoot string, nBitsForKeypair int, testnet bool, password string, mnemonic string, dbInit func(string, []byte, string) error) error

func GetCrosspostGateway added in v0.2.0

func GetCrosspostGateway(cfgPath string) ([]string, error)

func GetDropboxApiToken

func GetDropboxApiToken(cfgPath string) (string, error)

func GetResolverUrl

func GetResolverUrl(cfgPath string) (string, error)

func InitConfig

func InitConfig(repoRoot string) (*config.Config, error)

Types

type APIConfig added in v0.2.0

type APIConfig struct {
	Authenticated bool
	Username      string
	Password      string
	CORS          *string
	Enabled       bool
	HTTPHeaders   map[string][]string
	SSL           bool
	SSLCert       string
	SSLKey        string
}

func GetAPIConfig added in v0.2.0

func GetAPIConfig(cfgPath string) (*APIConfig, error)

type Cases added in v0.3.0

type Cases interface {
	// Save a new case
	Put(caseID string, state pb.OrderState, buyerOpened bool, claim string) error

	// Update a case with the buyer info
	UpdateBuyerInfo(caseID string, buyerContract *pb.RicardianContract, buyerValidationErrors []string, buyerPayoutAddress string, buyerOutpoints []*pb.Outpoint) error

	// Update a case with the vendor info
	UpdateVendorInfo(caseID string, vendorContract *pb.RicardianContract, vendorValidationErrors []string, vendorPayoutAddress string, vendorOutpoints []*pb.Outpoint) error

	// Mark a case as read in the database
	MarkAsRead(caseID string) error

	// Mark a case as closed in the database
	MarkAsClosed(caseID string, resolution *pb.DisputeResolution) error

	// Delete a case
	Delete(caseID string) error

	// Return the case metadata given a case ID
	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)

	// Return the dispute payout data for a case
	GetPayoutDetails(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerPayoutAddress, vendorPayoutAddress string, buyerOutpoints, vendorOutpoints []*pb.Outpoint, state pb.OrderState, err error)

	// Return the IDs for all cases
	GetAll() ([]string, error)
}

type Chat added in v0.3.1

type Chat interface {

	// Put a new chat message to the database
	Put(peerId string, subject string, message string, timestamp time.Time, read bool, outgoing bool) error

	// Returns a list of open conversations
	GetConversations() []ChatConversation

	// A list of messages given a peer ID and a subject
	GetMessages(peerID string, subject string, offsetID int, limit int) []ChatMessage

	// Mark all chat messages for a peer as read
	MarkAsRead(peerID string) error

	// Delete a message
	DeleteMessage(msgID int) error

	// Delete all messages from from a peer
	DeleteConversation(peerID string) error
}

type ChatConversation added in v0.3.1

type ChatConversation struct {
	PeerId string `json:"peerId"`
	Unread int    `json:"unread"`
}

type ChatMessage added in v0.3.1

type ChatMessage struct {
	MessageId int       `json:"messageId"`
	PeerId    string    `json:"peerId"`
	Subject   string    `json:"subject"`
	Message   string    `json:"message"`
	Read      bool      `json:"read"`
	Outgoing  bool      `json:"outgoing"`
	Timestamp time.Time `json:"timestamp"`
}

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 database 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
	Settings() Settings
	Inventory() Inventory
	Purchases() Purchases
	Sales() Sales
	Cases() Cases
	Chat() Chat
	Notifications() Notifications
	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(offsetId string, limit int) ([]string, error)

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

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

	// Are we followed by this peer?
	FollowsMe(peerId string) bool
}

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(offsetId string, limit int) ([]string, error)

	// Delete a peer from the database
	Delete(peer string) error

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

	// Am I following this peer?
	IsFollowing(peerId string) bool
}

type Inventory

type Inventory interface {
	/* Put an inventory count for a listing
	   Override the existing count if it exists */
	Put(slug string, count int) error

	// Return the count for a specific listing including variants
	GetSpecific(path string) (int, error)

	// Get the count for all variants of a given listing
	Get(slug string) (map[string]int, error)

	// Fetch all inventory countes
	GetAll() (map[string]int, error)

	// Delete a listing and related count
	Delete(path string) error

	// Delete all variants of a given slug
	DeleteAll(slug string) error
}

type Notifications added in v0.3.1

type Notifications interface {

	// Put a new notification to the database
	Put(notification notif.Data, timestamp time.Time) error

	// Mark notification as read
	MarkAsRead(notifID int) error

	// Fetch notifications from database
	GetAll(offsetID int, limit int) []notif.Notification

	// Delete a notification
	Delete(notifID int) error
}

type OfflineMessages

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

	// Does the given URL exist in the database?
	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 database
	Delete(id peer.ID) error

	// Delete all pointers of a given purpose
	DeleteAll(purpose ipfs.Purpose) error

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

type Purchases added in v0.1.2

type Purchases interface {
	// Save or update an order
	Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

	// Mark an order as read in the database
	MarkAsRead(orderID string) error

	// Update the funding level for the contract
	UpdateFunding(orderId string, funded bool, records []*spvwallet.TransactionRecord) error

	// Delete an order
	Delete(orderID string) error

	// Return a purchase given the payment address
	GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*spvwallet.TransactionRecord, err error)

	// Return a purchase given the order ID
	GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*spvwallet.TransactionRecord, read bool, err error)

	// Return the IDs for all orders
	GetAll() ([]string, error)
}

type SMTPSettings

type SMTPSettings struct {
	Notifications  bool   `json:"notifications"`
	ServerAddress  string `json:"serverAddress"`
	Username       string `json:"username"`
	Password       string `json:"password"`
	SenderEmail    string `json:"senderEmail"`
	RecipientEmail string `json:"recipientEmail"`
}

type Sales added in v0.1.2

type Sales interface {
	// Save or update a sale
	Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

	// Mark an order as read in the database
	MarkAsRead(orderID string) error

	// Update the funding level for the contract
	UpdateFunding(orderId string, funded bool, records []*spvwallet.TransactionRecord) error

	// Delete an order
	Delete(orderID string) error

	// Return a sale given the payment address
	GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*spvwallet.TransactionRecord, err error)

	// Return a sale given the order ID
	GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*spvwallet.TransactionRecord, read bool, err error)

	// Return the IDs for all orders
	GetAll() ([]string, error)
}

type Settings

type Settings interface {
	// Put settings to the database, overriding all fields
	Put(settings SettingsData) error

	// Update all non-nil fields
	Update(settings SettingsData) error

	// Return the settings object
	Get() (SettingsData, error)

	// Delete all settings data
	Delete() error
}

type SettingsData

type SettingsData struct {
	PaymentDataInQR    *bool              `json:"paymentDataInQR"`
	ShowNotifications  *bool              `json:"showNotifications"`
	ShowNsfw           *bool              `json:"showNsfw"`
	ShippingAddresses  *[]ShippingAddress `json:"shippingAddresses"`
	LocalCurrency      *string            `json:"localCurrency"`
	Country            *string            `json:"country"`
	Language           *string            `json:"language"`
	TermsAndConditions *string            `json:"termsAndConditions"`
	RefundPolicy       *string            `json:"refundPolicy"`
	BlockedNodes       *[]string          `json:"blockedNodes"`
	StoreModerators    *[]string          `json:"storeModerators"`
	MisPaymentBuffer   *float32           `json:"mispaymentBuffer"`
	SMTPSettings       *SMTPSettings      `json:"smtpSettings"`
	Version            *string            `json:"version"`
}

type ShippingAddress

type ShippingAddress struct {
	Name           string `json:"name"`
	Company        string `json:"company"`
	AddressLineOne string `json:"addressLineOne"`
	AddressLineTwo string `json:"addressLineTwo"`
	City           string `json:"city"`
	State          string `json:"state"`
	Country        string `json:"country"`
	PostalCode     string `json:"postalCode"`
	AddressNotes   string `json:"addressNotes"`
}

type WalletConfig added in v0.2.0

type WalletConfig struct {
	Type             string
	Binary           string
	MaxFee           int
	FeeAPI           string
	HighFeeDefault   int
	MediumFeeDefault int
	LowFeeDefault    int
	TrustedPeer      string
	RPCUser          string
	RPCPassword      string
}

func GetWalletConfig added in v0.2.0

func GetWalletConfig(cfgPath string) (*WalletConfig, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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