mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
refactor(master & authnode): split package rocksdb from raftstore to avoid import by other.
Signed-off-by: Victor1319 <834863182@qq.com>
This commit is contained in:
parent
7a0ad311a9
commit
67bba62544
@ -17,6 +17,7 @@ package authnode
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cubefs/cubefs/raftstore/raftstore_db"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -24,7 +25,6 @@ import (
|
||||
|
||||
"github.com/cubefs/cubefs/depends/tiglabs/raft"
|
||||
"github.com/cubefs/cubefs/depends/tiglabs/raft/proto"
|
||||
"github.com/cubefs/cubefs/raftstore"
|
||||
"github.com/cubefs/cubefs/util/keystore"
|
||||
"github.com/cubefs/cubefs/util/log"
|
||||
)
|
||||
@ -43,7 +43,7 @@ type raftApplySnapshotHandler func()
|
||||
|
||||
// KeystoreFsm represents the finite state machine of a keystore
|
||||
type KeystoreFsm struct {
|
||||
store *raftstore.RocksDBStore
|
||||
store *raftstore_db.RocksDBStore
|
||||
rs *raft.RaftServer
|
||||
applied uint64
|
||||
retainLogs uint64
|
||||
@ -59,7 +59,7 @@ type KeystoreFsm struct {
|
||||
id uint64 // current id of server
|
||||
}
|
||||
|
||||
func newKeystoreFsm(store *raftstore.RocksDBStore, retainsLog uint64, rs *raft.RaftServer) (fsm *KeystoreFsm) {
|
||||
func newKeystoreFsm(store *raftstore_db.RocksDBStore, retainsLog uint64, rs *raft.RaftServer) (fsm *KeystoreFsm) {
|
||||
fsm = new(KeystoreFsm)
|
||||
fsm.store = store
|
||||
fsm.rs = rs
|
||||
|
||||
@ -16,6 +16,7 @@ package authnode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cubefs/cubefs/raftstore/raftstore_db"
|
||||
"io/ioutil"
|
||||
syslog "log"
|
||||
"net/http"
|
||||
@ -61,7 +62,7 @@ type Server struct {
|
||||
leaderInfo *LeaderInfo
|
||||
config *clusterConfig
|
||||
cluster *Cluster
|
||||
rocksDBStore *raftstore.RocksDBStore
|
||||
rocksDBStore *raftstore_db.RocksDBStore
|
||||
raftStore raftstore.RaftStore
|
||||
fsm *KeystoreFsm
|
||||
partition raftstore.Partition
|
||||
@ -191,7 +192,7 @@ func (m *Server) Start(cfg *config.Config) (err error) {
|
||||
log.LogError(errors.Stack(err))
|
||||
return
|
||||
}
|
||||
if m.rocksDBStore, err = raftstore.NewRocksDBStore(m.storeDir, LRUCacheSize, WriteBufferSize); err != nil {
|
||||
if m.rocksDBStore, err = raftstore_db.NewRocksDBStore(m.storeDir, LRUCacheSize, WriteBufferSize); err != nil {
|
||||
log.LogErrorf("Start: init RocksDB fail: err(%v)", err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/cubefs/cubefs/raftstore"
|
||||
"github.com/cubefs/cubefs/raftstore/raftstore_db"
|
||||
"github.com/cubefs/cubefs/util/log"
|
||||
)
|
||||
|
||||
@ -32,7 +33,7 @@ type IDAllocator struct {
|
||||
commonID uint64
|
||||
clientID uint64
|
||||
quotaID uint32
|
||||
store *raftstore.RocksDBStore
|
||||
store *raftstore_db.RocksDBStore
|
||||
partition raftstore.Partition
|
||||
dpIDLock sync.RWMutex
|
||||
mpIDLock sync.RWMutex
|
||||
@ -40,7 +41,7 @@ type IDAllocator struct {
|
||||
qaIDLock sync.RWMutex
|
||||
}
|
||||
|
||||
func newIDAllocator(store *raftstore.RocksDBStore, partition raftstore.Partition) (alloc *IDAllocator) {
|
||||
func newIDAllocator(store *raftstore_db.RocksDBStore, partition raftstore.Partition) (alloc *IDAllocator) {
|
||||
alloc = new(IDAllocator)
|
||||
alloc.store = store
|
||||
alloc.partition = partition
|
||||
|
||||
@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/cubefs/cubefs/depends/tiglabs/raft"
|
||||
"github.com/cubefs/cubefs/depends/tiglabs/raft/proto"
|
||||
"github.com/cubefs/cubefs/raftstore"
|
||||
raftstore "github.com/cubefs/cubefs/raftstore/raftstore_db"
|
||||
"github.com/cubefs/cubefs/util/log"
|
||||
"github.com/cubefs/cubefs/util/stat"
|
||||
)
|
||||
|
||||
@ -17,6 +17,7 @@ package master
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/cubefs/cubefs/raftstore/raftstore_db"
|
||||
syslog "log"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
@ -117,7 +118,7 @@ type Server struct {
|
||||
config *clusterConfig
|
||||
cluster *Cluster
|
||||
user *User
|
||||
rocksDBStore *raftstore.RocksDBStore
|
||||
rocksDBStore *raftstore_db.RocksDBStore
|
||||
raftStore raftstore.RaftStore
|
||||
fsm *MetadataFsm
|
||||
partition raftstore.Partition
|
||||
@ -143,7 +144,7 @@ func (m *Server) Start(cfg *config.Config) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if m.rocksDBStore, err = raftstore.NewRocksDBStore(m.storeDir, LRUCacheSize, WriteBufferSize); err != nil {
|
||||
if m.rocksDBStore, err = raftstore_db.NewRocksDBStore(m.storeDir, LRUCacheSize, WriteBufferSize); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
// implied. See the License for the specific language governing
|
||||
// permissions and limitations under the License.
|
||||
|
||||
package raftstore
|
||||
package raftstore_db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
Loading…
Reference in New Issue
Block a user