From 67fbc38a2059999042986ab56e978a67b6348235 Mon Sep 17 00:00:00 2001 From: ucwong Date: Tue, 27 Feb 2024 20:46:25 +0800 Subject: [PATCH] fmt --- backend/block.go | 7 ++++--- backend/chaindb.go | 14 ++++++++------ backend/file.go | 3 ++- backend/torrent.go | 4 +++- backend/tree.go | 7 ++++--- cmd/robot/main.go | 3 ++- model_srv.go | 3 ++- monitor.go | 16 +++++++++------- rpc.go | 5 +++-- service.go | 7 ++++--- 10 files changed, 41 insertions(+), 28 deletions(-) diff --git a/backend/block.go b/backend/block.go index 960afa2..5225ec1 100644 --- a/backend/block.go +++ b/backend/block.go @@ -19,12 +19,13 @@ package backend import ( "encoding/json" "fmt" - "github.com/CortexFoundation/CortexTheseus/log" - "github.com/CortexFoundation/torrentfs/types" - bolt "go.etcd.io/bbolt" "sort" "strconv" "time" + + "github.com/CortexFoundation/CortexTheseus/log" + "github.com/CortexFoundation/torrentfs/types" + bolt "go.etcd.io/bbolt" ) func (fs *ChainDB) Blocks() []*types.Block { diff --git a/backend/chaindb.go b/backend/chaindb.go index 4e2e2c5..324ad65 100644 --- a/backend/chaindb.go +++ b/backend/chaindb.go @@ -18,20 +18,22 @@ package backend import ( "encoding/binary" + "os" + "path/filepath" + "strconv" + "sync" + "sync/atomic" + "time" + "github.com/CortexFoundation/merkletree" "github.com/CortexFoundation/torrentfs/params" "github.com/CortexFoundation/torrentfs/types" - "sync" - "sync/atomic" + //lru "github.com/hashicorp/golang-lru" "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/log" "github.com/google/uuid" bolt "go.etcd.io/bbolt" - "os" - "path/filepath" - "strconv" - "time" ) type ChainDB struct { diff --git a/backend/file.go b/backend/file.go index d9318ee..420d22e 100644 --- a/backend/file.go +++ b/backend/file.go @@ -18,11 +18,12 @@ package backend import ( "encoding/json" + "time" + "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/log" "github.com/CortexFoundation/torrentfs/types" bolt "go.etcd.io/bbolt" - "time" ) func (fs *ChainDB) Files() []*types.FileInfo { diff --git a/backend/torrent.go b/backend/torrent.go index b8136f1..22e4bb7 100644 --- a/backend/torrent.go +++ b/backend/torrent.go @@ -18,11 +18,13 @@ package backend import ( "errors" + "strconv" "strings" + //lru "github.com/hashicorp/golang-lru" + "github.com/CortexFoundation/CortexTheseus/log" bolt "go.etcd.io/bbolt" - "strconv" ) func (fs *ChainDB) Torrents() map[string]uint64 { diff --git a/backend/tree.go b/backend/tree.go index e6d2fd6..4044174 100644 --- a/backend/tree.go +++ b/backend/tree.go @@ -18,6 +18,10 @@ package backend import ( "errors" + "sort" + "strconv" + "time" + "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/common/hexutil" "github.com/CortexFoundation/CortexTheseus/log" @@ -25,9 +29,6 @@ import ( "github.com/CortexFoundation/torrentfs/params" "github.com/CortexFoundation/torrentfs/types" bolt "go.etcd.io/bbolt" - "sort" - "strconv" - "time" ) func (fs *ChainDB) Leaves() []merkletree.Content { diff --git a/cmd/robot/main.go b/cmd/robot/main.go index 8b016b1..1c888d8 100644 --- a/cmd/robot/main.go +++ b/cmd/robot/main.go @@ -7,8 +7,9 @@ import ( "time" "github.com/CortexFoundation/CortexTheseus/log" - "github.com/CortexFoundation/robot" "github.com/CortexFoundation/torrentfs/params" + + "github.com/CortexFoundation/robot" ) func main() { diff --git a/model_srv.go b/model_srv.go index 605725f..cfa4f35 100644 --- a/model_srv.go +++ b/model_srv.go @@ -19,12 +19,13 @@ package robot import ( "context" "errors" + "time" + "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/common/mclock" "github.com/CortexFoundation/CortexTheseus/log" "github.com/CortexFoundation/torrentfs/params" "github.com/CortexFoundation/torrentfs/types" - "time" ) func (m *Monitor) parseFileMeta(tx *types.Transaction, meta *types.FileMeta, b *types.Block) error { diff --git a/monitor.go b/monitor.go index 084cfc2..c2e6c9b 100644 --- a/monitor.go +++ b/monitor.go @@ -19,22 +19,24 @@ package robot import ( "context" "errors" + "math" + "path/filepath" + "runtime" + "sync" + "sync/atomic" + "time" + "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/common/mclock" "github.com/CortexFoundation/CortexTheseus/log" "github.com/CortexFoundation/CortexTheseus/rpc" - "github.com/CortexFoundation/robot/backend" "github.com/CortexFoundation/torrentfs/params" "github.com/CortexFoundation/torrentfs/types" lru "github.com/hashicorp/golang-lru/v2" ttl "github.com/hashicorp/golang-lru/v2/expirable" "github.com/ucwong/golang-kv" - "math" - "path/filepath" - "runtime" - "sync" - "sync/atomic" - "time" + + "github.com/CortexFoundation/robot/backend" ) // Monitor observes the data changes on the blockchain and synchronizes. diff --git a/rpc.go b/rpc.go index 07fc2c8..3abc4ae 100644 --- a/rpc.go +++ b/rpc.go @@ -18,13 +18,14 @@ package robot import ( "errors" + "strconv" + "time" + "github.com/CortexFoundation/CortexTheseus/common/hexutil" "github.com/CortexFoundation/CortexTheseus/log" "github.com/CortexFoundation/CortexTheseus/rpc" "github.com/CortexFoundation/torrentfs/params" "github.com/CortexFoundation/torrentfs/types" - "strconv" - "time" ) // SetConnection method builds connection to remote or local communicator. diff --git a/service.go b/service.go index 42afe5b..1b86e3b 100644 --- a/service.go +++ b/service.go @@ -19,14 +19,15 @@ package robot import ( "encoding/json" "errors" + "math/big" + "strconv" + "time" + "github.com/CortexFoundation/CortexTheseus/common" "github.com/CortexFoundation/CortexTheseus/common/mclock" "github.com/CortexFoundation/CortexTheseus/log" params1 "github.com/CortexFoundation/CortexTheseus/params" "github.com/CortexFoundation/torrentfs/types" - "math/big" - "strconv" - "time" ) // solve block from node