Skip to content

Commit aa3167e

Browse files
committed
minor touch ups across read me and block manager
1 parent 7d37809 commit aa3167e

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

blockmanager/fsyncdata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"syscall"
77
)
88

9+
// Fdatasync is a Linux-specific implementation of fdatasync.
910
func Fdatasync(fd uintptr) error {
1011
err := syscall.Fdatasync(int(fd))
1112
if err != nil {

blockmanager/fsyncdata_darwin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"golang.org/x/sys/unix"
88
)
99

10+
// // Fdatasync is a Darwin-specific implementation of fdatasync.
1011
func Fdatasync(fd uintptr) error {
1112
// F_FULLFSYNC forces the drive to flush its buffers to stable storage.
1213
_, _, errno := unix.Syscall(

blockmanager/openfile.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"syscall"
88
)
99

10+
// OpenFile opens a file with the specified name and flags, returning a file handle.
1011
func OpenFile(name string, flags int, perm uint32) (uintptr, error) {
1112
fd, err := syscall.Open(name, flags, perm)
1213
if err != nil {
@@ -15,6 +16,7 @@ func OpenFile(name string, flags int, perm uint32) (uintptr, error) {
1516
return uintptr(fd), nil
1617
}
1718

19+
// NewFileFromFd creates a new os.File from a file descriptor handle and a name.
1820
func NewFileFromFd(handle uintptr, name string) *os.File {
1921
return os.NewFile(handle, name)
2022
}

blockmanager/openfile_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"syscall"
99
)
1010

11+
// OpenFile opens a file with the specified name and flags, returning a file handle.
1112
func OpenFile(name string, flags int, perm uint32) (uintptr, error) {
1213
var access uint32
1314
var creation uint32
@@ -75,6 +76,7 @@ func OpenFile(name string, flags int, perm uint32) (uintptr, error) {
7576
return uintptr(handle), nil
7677
}
7778

79+
// NewFileFromFd creates a new os.File from a file descriptor handle and name.
7880
func NewFileFromFd(handle uintptr, name string) *os.File {
7981
return os.NewFile(handle, name)
8082
}

readme.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Wildcat is a high-performance embedded key-value database (or storage engine) wr
2323
- Automatic multi-threaded background compaction with configurable concurrency
2424
- ACID transaction support with configurable durability guarantees
2525
- Range, prefix, and full iteration support with bidirectional traversal
26-
- High transactional throughput per second with low latency due to lock-free and non-blocking design.
26+
- High transactional throughput per second with low latency due to lock-free and non-blocking design from memory to disk
2727
- Optional Bloom filters per SSTable for improved key lookup performance
2828
- Key-value separation optimization (`.klog` for keys, `.vlog` for values)
2929
- Tombstone-aware and version-aware compaction with retention based on active transaction read windows
@@ -134,7 +134,7 @@ The easiest way to interact with Wildcat is through the Update method, which han
134134
```go
135135
// Write a value
136136
err := db.Update(func(txn *wildcat.Txn) error {
137-
return txn.Put([]byte("hello"), []byte("world")) // Put update's existing key's values.
137+
return txn.Put([]byte("hello"), []byte("world")) // Put update's existing key's values
138138
})
139139
if err != nil {
140140
// Handle error
@@ -158,7 +158,6 @@ if err != nil {
158158
### Manual Transaction Management
159159
For more complex operations, you can manually manage transactions.
160160
```go
161-
// Begin a transaction
162161
txn, err := db.Begin()
163162
if err != nil {
164163
// Handle error
@@ -221,7 +220,6 @@ err := db.Update(func(txn *wildcat.Txn) error {
221220
```go
222221
// Perform batch operations
223222
for i := 0; i < 1000; i++ {
224-
// Begin a transaction
225223
txn, err := db.Begin()
226224
if err != nil {
227225
// Handle error
@@ -237,7 +235,6 @@ for i := 0; i < 1000; i++ {
237235
return
238236
}
239237

240-
// Commit the transaction
241238
err = txn.Commit()
242239
if err != nil {
243240
// Handle error
@@ -293,7 +290,6 @@ err := db.View(func(txn *wildcat.Txn) error {
293290
#### Range Iterator (bidirectional)
294291
```go
295292
err := db.View(func(txn *wildcat.Txn) error {
296-
// Create range iterator
297293
iter, err := txn.NewRangeIterator([]byte("start"), []byte("end"), true)
298294
if err != nil {
299295
return err
@@ -331,7 +327,6 @@ err := db.View(func(txn *wildcat.Txn) error {
331327
#### Prefix Iterator (bidirectional)
332328
```go
333329
err := db.View(func(txn *wildcat.Txn) error {
334-
// Create prefix iterator
335330
iter, err := txn.NewPrefixIterator([]byte("prefix"), true)
336331
if err != nil {
337332
return err

0 commit comments

Comments
 (0)