Documentation ¶
Overview ¶
Package initPkg handles the chifra init command. It When invoked, reads a value from a smart contract called **The Unchained Index** (0x0c316b7042b419d07d343f2f4f5bd54ff731183d). This value (manifestHashMap) is an IPFS hash pointing to a pinned file (called the Manifest) that contains a large collection of other IPFS hashes. These other hashes point to each of the Bloom filter and Index Chunk. TrueBlocks periodically publishes the Manifest's hash to the smart contract. This makes the index available for our software to use and impossible for us to withhold. Both of these aspects of the manifest are by design. If you stop chifra init before it finishes, it will pick up again where it left off the next time you run it. Certain parts of the system (chifra list and chifra export for example) if you have not previously run chifra init or chifra scrape. You will be warned by the system until it's satisfied. If you run chifra init and allow it to complete, the next time you run chifra scrape, it will start where init finished. This means that only the blooms will be stored on your hard drive. Subsequent scraping will produce both chunks and blooms, although you can, if you wish delete chunks that are not being used. You may periodically run chifra init if you prefer not to scrape.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Reasons = map[InitReason]string{ OKAY: "okay", FILE_ERROR: "file error", FILE_MISSING: "file missing", WRONG_SIZE: "wrong size", WRONG_MAGIC: "wrong magic number", WRONG_HASH: "wrong header hash", NOT_IN_MANIFEST: "not in manifest", AFTER_MANIFEST: "range after manifest", }
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
Types ¶
type InitOptions ¶
type InitOptions struct { All bool `json:"all,omitempty"` // In addition to Bloom filters, download full index chunks (recommended) DryRun bool `json:"dryRun,omitempty"` // Display the results of the download without actually downloading Publisher string `json:"publisher,omitempty"` // The publisher of the index to download FirstBlock uint64 `json:"firstBlock,omitempty"` // Do not download any chunks earlier than this block Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between downloads Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE PublisherAddr base.Address `json:"-"` }
InitOptions provides all command options for the chifra init command.
func GetInitOptions ¶
func GetInitOptions(args []string, g *globals.GlobalOptions) *InitOptions
GetInitOptions returns the options for this tool so other tools may use it.
func GetOptions ¶
func GetOptions() *InitOptions
func (*InitOptions) HandleDryRun ¶
func (opts *InitOptions) HandleDryRun() error
func (*InitOptions) HandleInit ¶
func (opts *InitOptions) HandleInit() error
HandleInit initializes local copy of UnchainedIndex by downloading manifests and chunks
func (*InitOptions) InitInternal ¶
func (opts *InitOptions) InitInternal() error
InitInternal handles the internal workings of the init command. Returns an error.
func (*InitOptions) String ¶
func (opts *InitOptions) String() string
String implements the Stringer interface
type InitReason ¶
type InitReason int
const ( OKAY InitReason = iota FILE_MISSING WRONG_SIZE WRONG_MAGIC WRONG_HASH FILE_ERROR NOT_IN_MANIFEST AFTER_MANIFEST )