From d947c8f30af8f0d62bfaa3205886450a6eee20a7 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman Date: Mon, 13 May 2019 16:04:53 -0500 Subject: [PATCH] Rename sync command to fullSync --- README.md | 4 ++-- cmd/{sync.go => fullSync.go} | 22 +++++++++++----------- documentation/data-syncing.md | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) rename cmd/{sync.go => fullSync.go} (83%) diff --git a/README.md b/README.md index c7181d16..132ad108 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ As mentioned above, VulcanizeDB's processes can be split into three categories: ### Data syncing To provide data for transformations, raw Ethereum data must first be synced into VulcanizeDB. -This is accomplished through the use of the `headerSync`, `sync`, or `coldImport` commands. -These commands are described in detail [here](documentation/sync.md). +This is accomplished through the use of the `headerSync`, `fullSync`, or `coldImport` commands. +These commands are described in detail [here](documentation/data-syncing.md). ### Data transformation Data transformation uses the raw data that has been synced into Postgres to filter out and apply transformations to diff --git a/cmd/sync.go b/cmd/fullSync.go similarity index 83% rename from cmd/sync.go rename to cmd/fullSync.go index 6dd2be07..4d29c43a 100644 --- a/cmd/sync.go +++ b/cmd/fullSync.go @@ -29,14 +29,14 @@ import ( "github.com/vulcanize/vulcanizedb/utils" ) -// syncCmd represents the sync command -var syncCmd = &cobra.Command{ - Use: "sync", +// fullSyncCmd represents the fullSync command +var fullSyncCmd = &cobra.Command{ + Use: "fullSync", Short: "Syncs VulcanizeDB with local ethereum node", Long: `Syncs VulcanizeDB with local ethereum node. Populates Postgres with blocks, transactions, receipts, and logs. -./vulcanizedb sync --starting-block-number 0 --config public.toml +./vulcanizedb fullSync --starting-block-number 0 --config public.toml Expects ethereum node to be running and requires a .toml config: @@ -49,14 +49,14 @@ Expects ethereum node to be running and requires a .toml config: ipcPath = "/Users/user/Library/Ethereum/geth.ipc" `, Run: func(cmd *cobra.Command, args []string) { - sync() + fullSync() }, } func init() { - rootCmd.AddCommand(syncCmd) + rootCmd.AddCommand(fullSyncCmd) - syncCmd.Flags().Int64VarP(&startingBlockNumber, "starting-block-number", "s", 0, "Block number to start syncing from") + fullSyncCmd.Flags().Int64VarP(&startingBlockNumber, "starting-block-number", "s", 0, "Block number to start syncing from") } func backFillAllBlocks(blockchain core.BlockChain, blockRepository datastore.BlockRepository, missingBlocksPopulated chan int, startingBlockNumber int64) { @@ -67,20 +67,20 @@ func backFillAllBlocks(blockchain core.BlockChain, blockRepository datastore.Blo missingBlocksPopulated <- populated } -func sync() { +func fullSync() { ticker := time.NewTicker(pollingInterval) defer ticker.Stop() blockChain := getBlockChain() lastBlock, err := blockChain.LastBlock() if err != nil { - log.Error("sync: Error getting last block: ", err) + log.Error("fullSync: Error getting last block: ", err) } if lastBlock.Int64() == 0 { log.Fatal("geth initial: state sync not finished") } if startingBlockNumber > lastBlock.Int64() { - log.Fatal("sync: starting block number > current block number") + log.Fatal("fullSync: starting block number > current block number") } db := utils.LoadPostgres(databaseConfig, blockChain.Node()) @@ -94,7 +94,7 @@ func sync() { case <-ticker.C: window, err := validator.ValidateBlocks() if err != nil { - log.Error("sync: error in validateBlocks: ", err) + log.Error("fullSync: error in validateBlocks: ", err) } log.Info(window.GetString()) case <-missingBlocksPopulated: diff --git a/documentation/data-syncing.md b/documentation/data-syncing.md index e838e47c..99564540 100644 --- a/documentation/data-syncing.md +++ b/documentation/data-syncing.md @@ -23,7 +23,7 @@ Syncs block headers from a running Ethereum node into the VulcanizeDB table `hea ``` - Alternatively, the ipc path can be passed as a flag instead `--client-ipcPath`. -## sync +## fullSync Syncs blocks, transactions, receipts and logs from a running Ethereum node into VulcanizeDB tables named `blocks`, `uncles`, `full_sync_transactions`, `full_sync_receipts` and `logs`. - Queries the Ethereum node using RPC calls. @@ -31,7 +31,7 @@ Syncs blocks, transactions, receipts and logs from a running Ethereum node into - Useful when you want to maintain a broad cache of what's happening on the blockchain. #### Usage -- Run `./vulcanizedb sync --config --starting-block-number ` +- Run `./vulcanizedb fullSync --config --starting-block-number ` - The config file must be formatted as follows, and should contain an ipc path to a running Ethereum node: ```toml [database]