diff --git a/go.mod b/go.mod index 16717d60f9..26f30de379 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1 github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8 github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 - github.com/CortexFoundation/torrentfs v1.0.55-0.20231027203605-3f8792552f00 + github.com/CortexFoundation/torrentfs v1.0.55-0.20231028221934-0e7bb6b51e2f github.com/VictoriaMetrics/fastcache v1.12.1 github.com/arsham/figurine v1.3.0 github.com/aws/aws-sdk-go-v2 v1.21.2 @@ -176,7 +176,7 @@ require ( github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/naoina/go-stringutil v0.1.0 // indirect - github.com/nutsdb/nutsdb v0.14.2-0.20231027074712-e6f23063dbc6 // indirect + github.com/nutsdb/nutsdb v0.14.2-0.20231028072431-6476fdb166a2 // indirect github.com/otiai10/copy v1.12.0 // indirect github.com/pion/datachannel v1.5.5 // indirect github.com/pion/dtls/v2 v2.2.7 // indirect @@ -217,7 +217,7 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd // indirect github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb // indirect - github.com/ucwong/golang-kv v1.0.23-0.20231027202923-47a531158579 // indirect + github.com/ucwong/golang-kv v1.0.23-0.20231028104334-07c4365a8371 // indirect github.com/ucwong/shard v1.0.1-0.20230924231639-2ac2d8ab288c // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/xujiajun/mmap-go v1.0.1 // indirect diff --git a/go.sum b/go.sum index 43c2917105..d39cae3db7 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,8 @@ github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1: github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q= github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk= github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA= -github.com/CortexFoundation/torrentfs v1.0.55-0.20231027203605-3f8792552f00 h1:8zx6F1kyya3ye2gAyG3+hR4CAgLvuEFHt0R0rP8QwgU= -github.com/CortexFoundation/torrentfs v1.0.55-0.20231027203605-3f8792552f00/go.mod h1:nFO9KcKouOMGb5OKBECVLpYQB+7QBohJTQLJG3UkuO0= +github.com/CortexFoundation/torrentfs v1.0.55-0.20231028221934-0e7bb6b51e2f h1:l86Zhj2ydFGWpJW/l9mhFCSscNaHwBitAFP9UXKAlg8= +github.com/CortexFoundation/torrentfs v1.0.55-0.20231028221934-0e7bb6b51e2f/go.mod h1:Cu7RvzLf9s1dOwgotOxsBFXhA4rG+JG3IjZVcqUhX8w= github.com/CortexFoundation/wormhole v0.0.2-0.20231018202213-693acd0cc941 h1:2lhbBGb0Q/v2Uk2P1qGWK//jmrZUGROZzME8psO9QNA= github.com/CortexFoundation/wormhole v0.0.2-0.20231018202213-693acd0cc941/go.mod h1:ipzmPabDgzYKUbXkGVe2gTkBEp+MsDx6pXGiuYzmP6s= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -902,8 +902,8 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/nutsdb/nutsdb v0.14.2-0.20231027074712-e6f23063dbc6 h1:kHtzTlqJDJDXgMTHmp6jV3hQuMvSBttkmSdBe3YZpZo= -github.com/nutsdb/nutsdb v0.14.2-0.20231027074712-e6f23063dbc6/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= +github.com/nutsdb/nutsdb v0.14.2-0.20231028072431-6476fdb166a2 h1:CIKzPJ85bNyRovvfzkEBqBE8J0YKEA/8AS2mOBqgi5g= +github.com/nutsdb/nutsdb v0.14.2-0.20231028072431-6476fdb166a2/go.mod h1:6inOji9rFBporXeHDjJny4g50RpQbkjSK5jI1hht0j8= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= @@ -1249,8 +1249,8 @@ github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd h1:gBtlvLAsgLk+ github.com/ucwong/filecache v1.0.6-0.20230405163841-810d53ced4bd/go.mod h1:ddwX+NCjMZPdpzcGh1fcEbNTUTCtKgt2hC2rqvmLKgA= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb h1:dVZH3AH9f7zB3VBmsjn25B7lfcAyMP4QxdFYTrfj7tg= github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb/go.mod h1:3yswsBsVuwsOjDvFfC5Na9XSEf4HC7mj3W3g6jvSY/s= -github.com/ucwong/golang-kv v1.0.23-0.20231027202923-47a531158579 h1:8r8SpAAu6/Kol1ZZmAcBJ529MMuLF0y8rcI0kBkDAK4= -github.com/ucwong/golang-kv v1.0.23-0.20231027202923-47a531158579/go.mod h1:K6Y8vZrxmfMXPgI/qfiRX8BuOWQoTAMUKl7XzlBtUYU= +github.com/ucwong/golang-kv v1.0.23-0.20231028104334-07c4365a8371 h1:4ipLTKZTHE4nlAabhC9o2IgMSU1zqKrh7tdNEe0nUfk= +github.com/ucwong/golang-kv v1.0.23-0.20231028104334-07c4365a8371/go.mod h1:b0j+bqqDjcjd/2hgeTlPmwdg+RuSITXsnlRmBKPoBCU= github.com/ucwong/golang-set v1.8.1-0.20200419153428-d7b0b1ac2d43/go.mod h1:xu0FaiQFGbBcFZj2o7udZ5rbA8jRTsv47hkPoG5qQNM= github.com/ucwong/goleveldb v1.0.3-0.20200508074755-578cba616f37/go.mod h1:dgJUTtDxq/ne6/JzZhHzF24OL/uqILz9IWk8HmT4V2g= github.com/ucwong/goleveldb v1.0.3-0.20200618184106-f1c6bc3a428b/go.mod h1:7Sq6w7AfEZuB/a6mrlvHCSXCSkqojCMMrM3Ei12QAT0= diff --git a/vendor/github.com/nutsdb/nutsdb/db.go b/vendor/github.com/nutsdb/nutsdb/db.go index f8b9f41538..7ea3c40f44 100644 --- a/vendor/github.com/nutsdb/nutsdb/db.go +++ b/vendor/github.com/nutsdb/nutsdb/db.go @@ -80,16 +80,16 @@ const ( // DataSortedSetBucketDeleteFlag represents the delete Sorted Set bucket flag DataSortedSetBucketDeleteFlag - // DataBPTreeBucketDeleteFlag represents the delete BPTree bucket flag - DataBPTreeBucketDeleteFlag + // DataBTreeBucketDeleteFlag represents the delete BTree bucket flag + DataBTreeBucketDeleteFlag // DataListBucketDeleteFlag represents the delete List bucket flag DataListBucketDeleteFlag - // LRemByIndex represents the data LRemByIndex flag + // DataLRemByIndex represents the data LRemByIndex flag DataLRemByIndex - // DataListBucketDeleteFlag represents that set ttl for the list + // DataExpireListFlag represents that set ttl for the list DataExpireListFlag ) @@ -291,8 +291,6 @@ func (db *DB) release() error { db.tm.close() - db = nil - if GCEnable { runtime.GC() } @@ -451,7 +449,7 @@ func (db *DB) doWrites() { case r = <-db.writeCh: reqs = append(reqs, r) default: - pendingCh <- struct{}{} // Push to pending before doing a write. + pendingCh <- struct{}{} // Push to pending before doing write. writeRequests(reqs) return } @@ -716,7 +714,7 @@ func (db *DB) buildNotDSIdxes(r *Record) { if r.H.Meta.Flag == DataSortedSetBucketDeleteFlag { db.deleteBucket(DataStructureSortedSet, r.Bucket) } - if r.H.Meta.Flag == DataBPTreeBucketDeleteFlag { + if r.H.Meta.Flag == DataBTreeBucketDeleteFlag { db.deleteBucket(DataStructureBTree, r.Bucket) } if r.H.Meta.Flag == DataListBucketDeleteFlag { @@ -911,8 +909,6 @@ func (db *DB) managed(writable bool, fn func(tx *Tx) error) (err error) { return err } -const bptDir = "bpt" - func (db *DB) sendToWriteCh(tx *Tx) (*request, error) { req := requestPool.Get().(*request) req.reset() diff --git a/vendor/github.com/nutsdb/nutsdb/list.go b/vendor/github.com/nutsdb/nutsdb/list.go index 5fcc4fc611..cfbfcc8d2c 100644 --- a/vendor/github.com/nutsdb/nutsdb/list.go +++ b/vendor/github.com/nutsdb/nutsdb/list.go @@ -27,12 +27,6 @@ var ( // ErrCount is returned when count is error. ErrCount = errors.New("err count") - // ErrRangeSizeNotMatchRecordSize is range size not match record size - ErrRangeSizeNotMatchRecordSize = errors.New("the length of the specified range is not equal to the length of the list") - - // ErrBuildListIndex is returned when build list index error. - ErrBuildListIndex = errors.New("build list index error") - // ErrEmptyList is returned when the list is empty. ErrEmptyList = errors.New("the list is empty") @@ -46,7 +40,7 @@ const ( // BTree represents the btree. -// list head and tail seq num +// HeadTailSeq list head and tail seq num type HeadTailSeq struct { Head uint64 Tail uint64 diff --git a/vendor/github.com/nutsdb/nutsdb/tx.go b/vendor/github.com/nutsdb/nutsdb/tx.go index fda041821c..9a439f0130 100644 --- a/vendor/github.com/nutsdb/nutsdb/tx.go +++ b/vendor/github.com/nutsdb/nutsdb/tx.go @@ -459,7 +459,7 @@ func (tx *Tx) getBucketDeleteRecordCount(entry *Entry) int64 { var res int64 switch entry.Meta.Flag { - case DataBPTreeBucketDeleteFlag: + case DataBTreeBucketDeleteFlag: if bTree, ok := tx.db.Index.bTree.idx[bucket]; ok { res = int64(bTree.Count()) } @@ -702,7 +702,7 @@ func (tx *Tx) buildIdxes(records []*Record) error { err = tx.db.buildSortedSetIdx(record) case DataStructureNone: switch meta.Flag { - case DataBPTreeBucketDeleteFlag: + case DataBTreeBucketDeleteFlag: tx.db.deleteBucket(DataStructureBTree, bucket) case DataSetBucketDeleteFlag: tx.db.deleteBucket(DataStructureSet, bucket) diff --git a/vendor/github.com/nutsdb/nutsdb/tx_bucket.go b/vendor/github.com/nutsdb/nutsdb/tx_bucket.go index 9e06229d45..e5d60a457f 100644 --- a/vendor/github.com/nutsdb/nutsdb/tx_bucket.go +++ b/vendor/github.com/nutsdb/nutsdb/tx_bucket.go @@ -65,7 +65,7 @@ func (tx *Tx) DeleteBucket(ds uint16, bucket string) error { return tx.put(bucket, []byte("1"), nil, Persistent, DataSortedSetBucketDeleteFlag, uint64(time.Now().Unix()), DataStructureNone) } if ds == DataStructureBTree { - return tx.put(bucket, []byte("2"), nil, Persistent, DataBPTreeBucketDeleteFlag, uint64(time.Now().Unix()), DataStructureNone) + return tx.put(bucket, []byte("2"), nil, Persistent, DataBTreeBucketDeleteFlag, uint64(time.Now().Unix()), DataStructureNone) } if ds == DataStructureList { return tx.put(bucket, []byte("3"), nil, Persistent, DataListBucketDeleteFlag, uint64(time.Now().Unix()), DataStructureNone) diff --git a/vendor/github.com/nutsdb/nutsdb/utils.go b/vendor/github.com/nutsdb/nutsdb/utils.go index a3500939a0..bcb098739b 100644 --- a/vendor/github.com/nutsdb/nutsdb/utils.go +++ b/vendor/github.com/nutsdb/nutsdb/utils.go @@ -23,7 +23,6 @@ import ( "path/filepath" "strings" - "github.com/xujiajun/utils/filesystem" "github.com/xujiajun/utils/strconv2" ) @@ -91,24 +90,6 @@ func getDataPath(fID int64, dir string) string { return dir + separator + strconv2.Int64ToStr(fID) + DataSuffix } -// getMetaPath returns the path for the meta file in the specified directory. -func getMetaPath(dir string) string { - separator := string(filepath.Separator) - return dir + separator + "meta" -} - -// getBucketMetaPath returns the path for the bucket meta file in the specified directory. -func getBucketMetaPath(dir string) string { - separator := string(filepath.Separator) - return getMetaPath(dir) + separator + "bucket" -} - -// getBPTDir returns the BPT directory path in the specified directory. -func getBPTDir(dir string) string { - separator := string(filepath.Separator) - return dir + separator + bptDir -} - func OneOfUint16Array(value uint16, array []uint16) bool { for _, v := range array { if v == value { @@ -118,15 +99,6 @@ func OneOfUint16Array(value uint16, array []uint16) bool { return false } -func createDirIfNotExist(dir string) error { - if ok := filesystem.PathIsExist(dir); !ok { - if err := os.MkdirAll(dir, os.ModePerm); err != nil { - return err - } - } - return nil -} - func splitIntStringStr(str, separator string) (int, string) { strList := strings.Split(str, separator) firstItem, _ := strconv2.StrToInt(strList[0]) diff --git a/vendor/modules.txt b/vendor/modules.txt index 2ab3a66d85..2f8a4ee0e8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -43,7 +43,7 @@ github.com/CortexFoundation/robot/backend # github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 ## explicit; go 1.16 github.com/CortexFoundation/statik -# github.com/CortexFoundation/torrentfs v1.0.55-0.20231027203605-3f8792552f00 +# github.com/CortexFoundation/torrentfs v1.0.55-0.20231028221934-0e7bb6b51e2f ## explicit; go 1.21 github.com/CortexFoundation/torrentfs github.com/CortexFoundation/torrentfs/backend @@ -752,7 +752,7 @@ github.com/naoina/go-stringutil ## explicit github.com/naoina/toml github.com/naoina/toml/ast -# github.com/nutsdb/nutsdb v0.14.2-0.20231027074712-e6f23063dbc6 +# github.com/nutsdb/nutsdb v0.14.2-0.20231028072431-6476fdb166a2 ## explicit; go 1.18 github.com/nutsdb/nutsdb # github.com/olekukonko/tablewriter v0.0.5 @@ -969,7 +969,7 @@ github.com/ucwong/filecache # github.com/ucwong/go-ttlmap v1.0.2-0.20221020173635-331e7ddde2bb ## explicit; go 1.19 github.com/ucwong/go-ttlmap -# github.com/ucwong/golang-kv v1.0.23-0.20231027202923-47a531158579 +# github.com/ucwong/golang-kv v1.0.23-0.20231028104334-07c4365a8371 ## explicit; go 1.21 github.com/ucwong/golang-kv github.com/ucwong/golang-kv/badger