Skip to content

Commit 6787bed

Browse files
committed
remove extra readonly opener
1 parent 6c0654e commit 6787bed

File tree

3 files changed

+3
-55
lines changed

3 files changed

+3
-55
lines changed

pkg/cmd/store.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ var StoreP2PInspectCmd = &cobra.Command{
7171
Use: "store-info",
7272
Short: "Inspect the go-header (P2P) stores and display their tail/head entries",
7373
Long: `Opens the datastore used by the node's go-header services and reports
74-
the current height, head, and tail information for both the header and data stores.
75-
The datastore is opened in read-only mode so that it can run against mounted snapshots
76-
or other read-only environments without requiring write access.`,
74+
the current height, head, and tail information for both the header and data stores.`,
7775
RunE: func(cmd *cobra.Command, args []string) error {
7876
nodeConfig, err := ParseConfig(cmd)
7977
if err != nil {
@@ -87,7 +85,7 @@ or other read-only environments without requiring write access.`,
8785

8886
dbName := resolveDBName(cmd)
8987

90-
rawStore, err := store.NewDefaultReadOnlyKVStore(nodeConfig.RootDir, nodeConfig.DBPath, dbName)
88+
rawStore, err := store.NewDefaultKVStore(nodeConfig.RootDir, nodeConfig.DBPath, dbName)
9189
if err != nil {
9290
return fmt.Errorf("failed to open datastore: %w", err)
9391
}

pkg/store/kv.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,8 @@ import (
1313

1414
// NewDefaultKVStore creates instance of default key-value store.
1515
func NewDefaultKVStore(rootDir, dbPath, dbName string) (ds.Batching, error) {
16-
return newDefaultKVStore(rootDir, dbPath, dbName, nil)
17-
}
18-
19-
// NewDefaultReadOnlyKVStore creates a key-value store opened in badger's read-only mode.
20-
//
21-
// This is useful for tools that only inspect state (such as store-info) where the
22-
// underlying data directory might be mounted read-only.
23-
func NewDefaultReadOnlyKVStore(rootDir, dbPath, dbName string) (ds.Batching, error) {
24-
opts := badger4.DefaultOptions
25-
opts.Options = opts.Options.WithReadOnly(true)
26-
return newDefaultKVStore(rootDir, dbPath, dbName, &opts)
27-
}
28-
29-
func newDefaultKVStore(rootDir, dbPath, dbName string, options *badger4.Options) (ds.Batching, error) {
3016
path := filepath.Join(rootify(rootDir, dbPath), dbName)
31-
return badger4.NewDatastore(path, options)
17+
return badger4.NewDatastore(path, nil)
3218
}
3319

3420
// PrefixEntries retrieves all entries in the datastore whose keys have the supplied prefix

pkg/store/kv_test.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)