repo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2016 License: MIT Imports: 16 Imported by: 129

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",
}
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(repoRoot string, nBitsForKeypair int, testnet bool, password string, mnemonic string, dbInit func(string, []byte, string) error) error

func GetAPICORS

func GetAPICORS(cfgPath string) (bool, error)

func GetAPIEnabled

func GetAPIEnabled(cfgPath string) (bool, error)

func GetAPIHeaders

func GetAPIHeaders(cfgPath string) (map[string][]string, error)

func GetAPIUsernameAndPw

func GetAPIUsernameAndPw(cfgPath string) (username, password string, err 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 GetMaxFee

func GetMaxFee(cfgPath string) (uint64, error)

func GetResolverUrl

func GetResolverUrl(cfgPath string) (string, error)

func InitConfig

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

Types

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
	Settings() Settings
	Inventory() Inventory
	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
}

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 databse.
	Delete(peer string) error

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

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 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

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

	// Fetch the entire list of pointers
	GetAll() ([]ipfs.Pointer, 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 Settings

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

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

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

type SettingsData

type SettingsData struct {
	PaymentDataInQR    *bool              `json:"paymentDataInQR"`
	ShowNotifications  *bool              `json:"showNotificatons"`
	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"`
	SMTPSettings       *SMTPSettings      `json:"smtpSettings"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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