-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
37 lines (32 loc) · 905 Bytes
/
types.go
File metadata and controls
37 lines (32 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package pebbledb
import "time"
// Entry represents a key-value pair with metadata
type Entry struct {
Key string
Value []byte
Timestamp int64
Deleted bool // Tombstone marker for deletions
}
// NewEntry creates a new entry with the current timestamp
func NewEntry(key string, value []byte, deleted bool) *Entry {
return &Entry{
Key: key,
Value: value,
Timestamp: time.Now().UnixNano(),
Deleted: deleted,
}
}
// Config holds configuration for the database
type Config struct {
DataDir string // Directory to store data files
MemtableSize int // Max size of memtable before flush (in entries)
CompactionPeriod int // How often to run compaction (in seconds)
}
// DefaultConfig returns a default configuration
func DefaultConfig() *Config {
return &Config{
DataDir: "./data",
MemtableSize: 1000,
CompactionPeriod: 60,
}
}