add comments, remove extra function

pull/4351/head
“GheisMohammadi” 2 years ago committed by Casey Gardiner
parent cc0f3d459d
commit 088ae63713
  1. 11
      api/service/stagedstreamsync/stages.go
  2. 1
      api/service/stagedstreamsync/syncing.go

@ -16,6 +16,7 @@ const (
Finish SyncStageID = "Finish" // Nominal stage after all other stages
)
// GetStageName returns the stage name in string
func GetStageName(stage string, isBeacon bool, prune bool) string {
name := stage
if isBeacon {
@ -27,18 +28,11 @@ func GetStageName(stage string, isBeacon bool, prune bool) string {
return name
}
// GetStageID returns the stage name in bytes
func GetStageID(stage SyncStageID, isBeacon bool, prune bool) []byte {
return []byte(GetStageName(string(stage), isBeacon, prune))
}
func GetBucketName(bucketName string, isBeacon bool) string {
name := bucketName
if isBeacon {
name = "Beacon" + name
}
return name
}
// GetStageProgress retrieves saved progress of a given sync stage from the database
func GetStageProgress(db kv.Getter, stage SyncStageID, isBeacon bool) (uint64, error) {
stgID := GetStageID(stage, isBeacon, false)
@ -65,6 +59,7 @@ func GetStageCleanUpProgress(db kv.Getter, stage SyncStageID, isBeacon bool) (ui
return unmarshalData(v)
}
// SaveStageCleanUpProgress stores the progress of the clean up for a given sync stage to the database
func SaveStageCleanUpProgress(db kv.Putter, stage SyncStageID, isBeacon bool, progress uint64) error {
stgID := GetStageID(stage, isBeacon, true)
return db.Put(kv.SyncStageProgress, stgID, marshalData(progress))

@ -134,6 +134,7 @@ func initDB(ctx context.Context, mainDB kv.RwDB, dbs []kv.RwDB, concurrency int)
return nil
}
// GetBlockDbPath returns the path of the cache database which stores blocks
func GetBlockDbPath(beacon bool, loopID int) string {
if beacon {
if loopID >= 0 {

Loading…
Cancel
Save