Skip to content

Commit ca9aa37

Browse files
committed
merge: resolve conflicts with origin/main into rkuris/logging-subsystem-improvements (keep RootStore flag and new logging options)
2 parents 10bbb63 + 5d96aff commit ca9aa37

File tree

22 files changed

+621
-638
lines changed

22 files changed

+621
-638
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
## How this works
44

55
## How this was tested
6-
7-
## Need to be documented in RELEASES.md?

Cargo.lock

Lines changed: 1 addition & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
// Open a database with default configuration
18-
db, err := ffi.New("/path/to/database.db")
18+
db, err := ffi.New("/path/to/database_dir")
1919
if err != nil {
2020
log.Fatal(err)
2121
}
@@ -29,7 +29,7 @@ defer db.Close(ctx)
2929
Firewood uses the functional options pattern for configuration. You can customize the database by passing option functions:
3030

3131
```go
32-
db, err := ffi.New("/path/to/database.db",
32+
db, err := ffi.New("/path/to/database_dir",
3333
ffi.WithTruncate(true), // Clear the database if it exists
3434
ffi.WithNodeCacheEntries(2_000_000), // Set node cache size
3535
ffi.WithFreeListCacheEntries(50_000), // Set freelist cache size

ffi/firewood.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type config struct {
9292
revisions uint
9393
// readCacheStrategy is the caching strategy used for the node cache.
9494
readCacheStrategy CacheStrategy
95+
<<<<<<< HEAD
9596
// rootStoreDir defines a path to store all historical roots on disk.
9697
rootStoreDir string
9798
// logPath is the file path where logs will be written.
@@ -100,6 +101,10 @@ type config struct {
100101
// logFilter is the RUST_LOG format filter string for logging.
101102
// If empty and logPath is set, env_logger defaults will be used.
102103
logFilter string
104+
=======
105+
// rootStore defines whether to enable storing all historical revisions on disk.
106+
rootStore bool
107+
>>>>>>> origin/main
103108
}
104109

105110
func defaultConfig() *config {
@@ -161,13 +166,13 @@ func WithReadCacheStrategy(strategy CacheStrategy) Option {
161166
}
162167
}
163168

164-
// WithRootStoreDir sets a path to store all historical roots on disk.
169+
// WithRootStore defines whether to enable storing all historical revisions on disk.
165170
// When set, historical revisions will be persisted to disk even after being
166171
// removed from memory (based on the Revisions limit).
167-
// Default: empty string (no disk persistence)
168-
func WithRootStoreDir(dir string) Option {
172+
// Default: false
173+
func WithRootStore() Option {
169174
return func(c *config) {
170-
c.rootStoreDir = dir
175+
c.rootStore = true
171176
}
172177
}
173178

@@ -217,7 +222,7 @@ const (
217222
)
218223

219224
// New opens or creates a new Firewood database with the given options.
220-
// The database file will be created at the provided file path if it does not
225+
// The database directory will be created at the provided path if it does not
221226
// already exist.
222227
//
223228
// If no [Option] is provided, sensible defaults will be used.
@@ -226,7 +231,7 @@ const (
226231
// It is the caller's responsibility to call [Database.Close] when the database
227232
// is no longer needed. No other [Database] in this process should be opened with
228233
// the same file path until the database is closed.
229-
func New(filePath string, opts ...Option) (*Database, error) {
234+
func New(dbDir string, opts ...Option) (*Database, error) {
230235
conf := defaultConfig()
231236
for _, opt := range opts {
232237
opt(conf)
@@ -267,13 +272,13 @@ func New(filePath string, opts ...Option) (*Database, error) {
267272
defer pinner.Unpin()
268273

269274
args := C.struct_DatabaseHandleArgs{
270-
path: newBorrowedBytes([]byte(filePath), &pinner),
275+
dir: newBorrowedBytes([]byte(dbDir), &pinner),
271276
cache_size: C.size_t(conf.nodeCacheEntries),
272277
free_list_cache_size: C.size_t(conf.freeListCacheEntries),
273278
revisions: C.size_t(conf.revisions),
274279
strategy: C.uint8_t(conf.readCacheStrategy),
275280
truncate: C.bool(conf.truncate),
276-
root_store_path: newBorrowedBytes([]byte(conf.rootStoreDir), &pinner),
281+
root_store: C.bool(conf.rootStore),
277282
}
278283

279284
return getDatabaseFromHandleResult(C.fwd_open_db(args))

ffi/firewood.h

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)