sombra 0.3.2

High-performance graph database with ACID transactions, single-file storage, and bindings for Rust, TypeScript, and Python
Documentation
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
# Operations Guide

This guide covers operational aspects of running Sombra in production, including monitoring, backup procedures, disaster recovery, and troubleshooting.

## Monitoring

### Health Checks

Sombra provides built-in health monitoring to assess system status:

```rust
use sombra::{GraphDB, HealthStatus};

let db = GraphDB::open("production.db")?;
let health = db.health_check()?;

match health.status {
    HealthStatus::Healthy => println!("System operating normally"),
    HealthStatus::Degraded => println!("Performance degraded, investigate"),
    HealthStatus::Unhealthy => println!("System needs immediate attention"),
}

// Check individual health indicators
for check in health.checks {
    println!("{}: {} - {}", check.name, check.healthy, check.message);
}
```

### Performance Metrics

Monitor key performance indicators:

```rust
let metrics = db.get_performance_metrics();

// Throughput metrics
println!("Transactions/sec: {}", metrics.transactions_per_second);
println!("Reads/sec: {}", metrics.reads_per_second);
println!("Writes/sec: {}", metrics.writes_per_second);

// Latency metrics
println!("P50 commit latency: {}ms", metrics.p50_commit_latency());
println!("P95 commit latency: {}ms", metrics.p95_commit_latency());
println!("P99 commit latency: {}ms", metrics.p99_commit_latency());

// Resource metrics
println!("Cache hit rate: {:.2}%", metrics.cache_hit_rate * 100.0);
println!("WAL size: {}MB", metrics.wal_size_bytes / 1024 / 1024);
println!("Dirty pages: {}", metrics.dirty_pages);
```

### Metrics Export

Export metrics to monitoring systems:

```rust
// Prometheus format
let prometheus_metrics = metrics.to_prometheus_format();
println!("{}", prometheus_metrics);

// JSON format
let json_metrics = metrics.to_json();
println!("{}", json_metrics);

// StatsD format
let statsd_metrics = metrics.to_statsd();
println!("{}", statsd_metrics);
```

### Structured Logging

Configure structured logging for production monitoring:

```rust
use sombra::logging;

// Initialize logging with JSON output
logging::init_logging("info,json")?;

// Logs will include:
// - Transaction lifecycle events
// - Performance warnings (>100ms operations)
// - Error conditions and corruption detection
// - Resource usage alerts
```

## Backup and Restore

### Online Backup

Create consistent backups without downtime:

```rust
use sombra::backup::BackupManager;

let db = GraphDB::open("production.db")?;
let backup_manager = BackupManager::new(&db);

// Create incremental backup
backup_manager.create_incremental_backup("backups/inc_20240115_120000")?;

// Create full backup
backup_manager.create_full_backup("backups/full_20240115_120000")?;

// List available backups
let backups = backup_manager.list_backups()?;
for backup in backups {
    println!("{}: {} ({})", backup.name, backup.type_, backup.size);
}
```

### Point-in-Time Recovery

Restore to a specific point in time:

```rust
// Restore from backup
backup_manager.restore_from_backup(
    "backups/full_20240115_120000",
    "restored.db"
)?;

// Apply WAL replay up to specific time
backup_manager.replay_wal_until(
    "restored.db",
    chrono::DateTime::parse_from_rfc3339("2024-01-15T12:30:00Z")?
)?;
```

### Automated Backup Script

Set up automated backups:

```bash
#!/bin/bash
# backup.sh - Daily backup script

BACKUP_DIR="/backups/sombra"
DB_PATH="/data/production.db"
DATE=$(date +%Y%m%d_%H%M%S)

# Create backup directory
mkdir -p "$BACKUP_DIR"

# Create full backup on Sunday, incremental otherwise
if [ $(date +%u) -eq 7 ]; then
    sombra-backup --type full --input "$DB_PATH" --output "$BACKUP_DIR/full_$DATE"
else
    sombra-backup --type incremental --input "$DB_PATH" --output "$BACKUP_DIR/inc_$DATE"
fi

# Clean up old backups (keep 30 days)
find "$BACKUP_DIR" -name "*.backup" -mtime +30 -delete

# Verify backup integrity
sombra-verify --backup "$BACKUP_DIR/inc_$DATE" || {
    echo "Backup verification failed!"
    exit 1
}
```

## Disaster Recovery

### WAL Recovery

Automatic WAL recovery on database startup:

```rust
// This happens automatically on GraphDB::open()
let db = GraphDB::open("production.db")?;

// Manual WAL recovery if needed
use sombra::recovery::WALRecovery;

let recovery = WALRecovery::new("production.db");
let report = recovery.recover()?;

println!("Recovered {} transactions", report.transactions_recovered);
println!("Applied {} WAL frames", report.frames_applied);
if !report.corrupted_frames.is_empty() {
    println!("Found {} corrupted frames", report.corrupted_frames.len());
}
```

### Database Repair

Repair corrupted databases:

```rust
use sombra::repair::DatabaseRepair;

let repair = DatabaseRepair::new("corrupted.db");

// Verify integrity
let report = repair.verify_integrity()?;
if report.is_healthy() {
    println!("Database is healthy");
} else {
    println!("Found {} issues", report.issues.len());
    
    // Attempt repair
    let repair_report = repair.repair()?;
    println!("Repaired {} issues", repair_report.issues_fixed);
}
```

### Salvage Data from Corrupted Database

Extract readable data when repair fails:

```rust
let salvage = DatabaseRepair::new("corrupted.db");

// Salvage nodes
let nodes = salvage.salvage_nodes()?;
println!("Salvaged {} nodes", nodes.len());

// Salvage edges
let edges = salvage.salvage_edges()?;
println!("Salvaged {} edges", edges.len());

// Export to new database
let new_db = GraphDB::create("salvaged.db")?;
let mut tx = new_db.begin_transaction()?;

for node in nodes {
    tx.create_node(&node.label, node.properties)?;
}

for edge in edges {
    tx.create_edge(edge.from_id, edge.to_id, &edge.label, edge.properties)?;
}

tx.commit()?;
```

## Database Maintenance

### Checkpoint Management

Manage WAL checkpoints for optimal performance:

```rust
// Manual checkpoint
db.checkpoint()?;

// Checkpoint with options
use sombra::CheckpointMode;

db.checkpoint_with_mode(CheckpointMode::Full)?;     // Force full checkpoint
db.checkpoint_with_mode(CheckpointMode::Restart)?;   // Restart log sequence
db.checkpoint_with_mode(CheckpointMode::Truncate)?;  // Truncate WAL file

// Checkpoint status
let status = db.checkpoint_status()?;
println!("WAL size: {}MB", status.wal_size_bytes / 1024 / 1024);
println!("Checkpoint pending: {}", status.checkpoint_pending);
```

### Index Maintenance

Rebuild indexes for optimal query performance:

```rust
use sombra::index::IndexManager;

let index_manager = IndexManager::new(&db);

// Rebuild all indexes
index_manager.rebuild_all_indexes()?;

// Rebuild specific index
index_manager.rebuild_label_index("User")?;
index_manager.rebuild_property_index("email")?;

// Analyze index statistics
let stats = index_manager.get_index_statistics()?;
for stat in stats {
    println!("Index {}: {} entries, {:.2}% selectivity", 
        stat.name, stat.entries, stat.selectivity * 100.0);
}
```

### Database Compaction

Reduce database file size and improve performance:

```rust
use sombra::maintenance::DatabaseCompactor;

let compactor = DatabaseCompactor::new(&db);

// Analyze fragmentation
let analysis = compactor.analyze_fragmentation()?;
println!("Fragmentation: {:.2}%", analysis.fragmentation_percentage);
println!("Free pages: {}", analysis.free_pages);
println!("Reclaimable space: {}MB", analysis.reclaimable_bytes / 1024 / 1024);

// Compact database
if analysis.fragmentation_percentage > 20.0 {
    println!("Starting compaction...");
    let report = compactor.compact()?;
    println!("Compaction completed:");
    println!("  Pages moved: {}", report.pages_moved);
    println!("  Space reclaimed: {}MB", report.bytes_reclaimed / 1024 / 1024);
    println!("  Time taken: {}ms", report.duration_ms);
}
```

## Performance Tuning in Production

### Real-time Performance Adjustment

Adjust configuration based on current load:

```rust
use sombra::adaptive::AdaptiveConfig;

let adaptive_config = AdaptiveConfig::new(&db);

// Enable adaptive tuning
adaptive_config.enable_adaptive_tuning()?;

// Monitor and adjust automatically
adaptive_config.set_monitoring_interval(60000); // 1 minute

// Manual adjustment based on metrics
let metrics = db.get_performance_metrics();

if metrics.cache_hit_rate < 0.8 {
    // Increase cache size
    let new_cache_size = (db.config().cache_size as f64 * 1.2) as usize;
    db.update_cache_size(new_cache_size)?;
}

if metrics.p99_commit_latency() > 100 {
    // Enable group commit
    db.enable_group_commit(5, 50)?; // 5ms interval, 50 max tx
}
```

### Load Balancing

For multi-instance deployments:

```rust
use sombra::cluster::LoadBalancer;

let load_balancer = LoadBalancer::new(vec![
    "db1.example.com:8080",
    "db2.example.com:8080", 
    "db3.example.com:8080"
]);

// Route read requests
let db = load_balancer.get_read_connection()?;

// Route write requests to primary
let primary = load_balancer.get_write_connection()?;

// Monitor instance health
load_balancer.health_check_all()?;
```

## Troubleshooting

### Common Issues

#### High Memory Usage

**Symptoms:**
- Process using more memory than configured
- OOM errors

**Diagnosis:**
```rust
let metrics = db.get_performance_metrics();
println!("Cache size: {}MB", metrics.cache_size_bytes / 1024 / 1024);
println!("Dirty pages: {}", metrics.dirty_pages);
println!("Memory pressure: {}", metrics.memory_pressure);
```

**Solutions:**
```rust
// Reduce cache size
db.update_cache_size(db.config().cache_size / 2)?;

// Force checkpoint to clear dirty pages
db.checkpoint_with_mode(CheckpointMode::Full)?;

// Enable memory pressure monitoring
db.enable_memory_pressure_monitoring(0.8)?; // Alert at 80%
```

#### Slow Performance

**Symptoms:**
- High query latency
- Low throughput

**Diagnosis:**
```rust
let metrics = db.get_performance_metrics();
println!("Cache hit rate: {:.2}%", metrics.cache_hit_rate * 100.0);
println!("WAL size: {}MB", metrics.wal_size_bytes / 1024 / 1024);
println!("Dirty pages: {}", metrics.dirty_pages);
```

**Solutions:**
```rust
// Increase cache size if hit rate is low
if metrics.cache_hit_rate < 0.9 {
    db.update_cache_size(db.config().cache_size * 2)?;
}

// Checkpoint if WAL is large
if metrics.wal_size_bytes > 100 * 1024 * 1024 { // 100MB
    db.checkpoint()?;
}

// Enable group commit for write-heavy workloads
db.enable_group_commit(10, 100)?;
```

#### Database Corruption

**Symptoms:**
- Corruption errors
- Crashes on read/write

**Diagnosis:**
```rust
use sombra::integrity::IntegrityChecker;

let checker = IntegrityChecker::new("production.db");
let report = checker.verify()?;

if !report.is_healthy() {
    println!("Corruption detected:");
    for issue in &report.issues {
        println!("  {}: {}", issue.severity, issue.description);
    }
}
```

**Solutions:**
```rust
// Attempt repair
let repair = DatabaseRepair::new("production.db");
let repair_report = repair.repair()?;

if repair_report.success {
    println!("Repair successful");
} else {
    println!("Repair failed, attempting salvage");
    
    // Salvage data to new database
    let salvage = DatabaseRepair::new("production.db");
    let nodes = salvage.salvage_nodes()?;
    let edges = salvage.salvage_edges()?;
    
    // Create new database with salvaged data
    create_new_database_from_salvage("recovered.db", nodes, edges)?;
}
```

### Debug Mode

Enable detailed debugging for troubleshooting:

```rust
use sombra::debug::DebugMode;

// Enable debug mode
let debug = DebugMode::enable(&db)?;

// Trace specific operations
debug.trace_operations(vec!["transaction_commit", "page_read"])?;

// Capture detailed logs
debug.enable_detailed_logging("debug.log")?;

// Performance profiling
debug.start_profiling()?;
// ... run operations ...
let profile = debug.stop_profiling()?;
println!("Profile: {}", profile.summary());
```

## Security Operations

### Access Control

Implement database-level access control:

```rust
use sombra::security::{AccessControl, Permission, Role};

let acl = AccessControl::new();

// Define roles
acl.add_role("admin", vec![
    Permission::Read,
    Permission::Write,
    Permission::Delete,
    Permission::Backup,
    Permission::Configure
])?;

acl.add_role("user", vec![
    Permission::Read,
    Permission::Write
])?;

acl.add_role("readonly", vec![
    Permission::Read
])?;

// Assign roles to users
acl.assign_role("alice", "admin")?;
acl.assign_role("bob", "user")?;
acl.assign_role("charlie", "readonly")?;

// Enforce access control
db.set_access_control(acl)?;
```

### Audit Logging

Track all database operations:

```rust
use sombra::audit::AuditLogger;

let audit = AuditLogger::new("audit.log");

// Log all operations
audit.log_all_operations()?;

// Log specific operations
audit.log_operations(vec![
    "node_create",
    "edge_create", 
    "node_delete",
    "transaction_commit"
])?;

// Query audit log
let operations = audit.query_operations(
    chrono::Utc::now() - chrono::Duration::hours(24),
    chrono::Utc::now(),
    Some("alice")
)?;
```

### Encryption

Enable data-at-rest encryption:

```rust
use sombra::encryption::EncryptionConfig;

let encryption_config = EncryptionConfig::new()
    .with_key_from_env("SOMBRA_ENCRYPTION_KEY")?
    .with_algorithm("AES-256-GCM")?;

let config = Config::builder()
    .encryption(encryption_config)
    .build();

let db = GraphDB::open_with_config("encrypted.db", config)?;
```

## Automation and Scripting

### Maintenance Automation

Automate routine maintenance tasks:

```bash
#!/bin/bash
# maintenance.sh - Daily maintenance script

DB_PATH="/data/production.db"
BACKUP_DIR="/backups"
LOG_FILE="/var/log/sombra-maintenance.log"

log() {
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
}

# Health check
log "Starting health check..."
if ! sombra-health-check --db "$DB_PATH"; then
    log "Health check failed!"
    exit 1
fi

# Backup
log "Creating backup..."
sombra-backup --type incremental --input "$DB_PATH" --output "$BACKUP_DIR/inc_$(date +%Y%m%d_%H%M%S)"

# Checkpoint if WAL is large
WAL_SIZE=$(sombra-info --db "$DB_PATH" --wal-size)
if [ "$WAL_SIZE" -gt 104857600 ]; then  # 100MB
    log "WAL size is ${WAL_SIZE} bytes, checkpointing..."
    sombra-checkpoint --db "$DB_PATH" --mode full
fi

# Compact if fragmentation is high
FRAGMENTATION=$(sombra-info --db "$DB_PATH" --fragmentation)
if (( $(echo "$FRAGMENTATION > 20.0" | bc -l) )); then
    log "Fragmentation is ${FRAGMENTATION}%, compacting..."
    sombra-compact --db "$DB_PATH"
fi

log "Maintenance completed successfully"
```

### Monitoring Integration

Integrate with monitoring systems:

```python
# monitoring.py - Prometheus metrics exporter
import time
import sombra
from prometheus_client import start_http_server, Gauge, Counter

# Metrics
cache_hit_rate = Gauge('sombra_cache_hit_rate', 'Cache hit rate')
commit_latency = Gauge('sombra_commit_latency_ms', 'Commit latency')
transactions_total = Counter('sombra_transactions_total', 'Total transactions')

def update_metrics():
    db = sombra.GraphDB('/data/production.db')
    metrics = db.get_performance_metrics()
    
    cache_hit_rate.set(metrics.cache_hit_rate)
    commit_latency.set(metrics.p99_commit_latency())
    transactions_total.inc(metrics.transactions_committed)

def main():
    start_http_server(8080)
    
    while True:
        update_metrics()
        time.sleep(60)

if __name__ == '__main__':
    main()
```

## Range Queries and Ordered Access

### Node Range Queries

Sombra provides efficient range queries using the BTreeMap-based node index:

```rust
use sombra::GraphDB;

let mut db = GraphDB::open("production.db")?;

// Get all nodes in a specific ID range
let node_ids = db.get_nodes_in_range(100, 200);
println!("Found {} nodes between IDs 100 and 200", node_ids.len());

// Get all nodes from a starting ID onwards
let node_ids = db.get_nodes_from(1000);
println!("Found {} nodes with ID >= 1000", node_ids.len());

// Get all nodes up to an ending ID
let node_ids = db.get_nodes_to(500);
println!("Found {} nodes with ID <= 500", node_ids.len());
```

### Ordered Node Access

Access nodes in sorted order by their IDs:

```rust
// Get the first node (lowest ID)
if let Some(first_id) = db.get_first_node() {
    let node = db.get_node(first_id)?;
    println!("First node: {:?}", node);
}

// Get the last node (highest ID)
if let Some(last_id) = db.get_last_node() {
    let node = db.get_node(last_id)?;
    println!("Last node: {:?}", node);
}

// Get first N nodes (for pagination)
let first_100 = db.get_first_n_nodes(100);
println!("First 100 node IDs: {:?}", first_100);

// Get last N nodes (recent items)
let last_100 = db.get_last_n_nodes(100);
println!("Last 100 node IDs: {:?}", last_100);

// Get all node IDs in sorted order
let all_ids = db.get_all_node_ids_ordered();
println!("Total nodes: {}", all_ids.len());
```

### Use Cases for Range Queries

**Pagination:**
```rust
// Page through nodes in ID order
let page_size = 100;
let page_number = 5;

let all_ids = db.get_all_node_ids_ordered();
let start = page_number * page_size;
let page_ids = &all_ids[start..std::cmp::min(start + page_size, all_ids.len())];

for &node_id in page_ids {
    let node = db.get_node(node_id)?;
    println!("{:?}", node);
}
```

**Timeline Views:**
```rust
// Get most recent nodes (assuming IDs are sequential)
let recent_ids = db.get_last_n_nodes(50);
for &node_id in &recent_ids {
    let node = db.get_node(node_id)?;
    println!("Recent: {:?}", node);
}
```

**Batch Processing:**
```rust
// Process nodes in chunks
let chunk_size = 1000;
let all_ids = db.get_all_node_ids_ordered();

for chunk in all_ids.chunks(chunk_size) {
    // Process batch
    for &node_id in chunk {
        let node = db.get_node(node_id)?;
        // ... process node
    }
    
    // Checkpoint after each batch
    db.checkpoint()?;
}
```

### Range Queries in Transactions

Range queries work seamlessly in transactions:

```rust
let mut tx = db.begin_transaction()?;

// Query nodes in range
let node_ids = tx.get_nodes_in_range(100, 200);

// Modify nodes found in range
for &node_id in &node_ids {
    tx.set_node_property(
        node_id,
        "batch_processed".to_string(),
        PropertyValue::Bool(true)
    )?;
}

tx.commit()?;
```

### Performance Characteristics

Range queries leverage the BTreeMap index for optimal performance:

- **Point lookup**: O(log n) - ~440ns for 10K nodes
- **Range scan**: O(log n + k) - where k is result size
- **Full iteration**: O(n) - ~2.6ns per node (very fast)
- **First/Last N**: O(log n + k) - < 1µs for N=100

**Key Advantages:**
- Native ordering (no sorting needed)
- Efficient range queries (much faster than HashMap)
- Better cache locality for sequential access
- Predictable performance

## Property Updates

### Updating Node Properties

Modify node properties efficiently using `set_node_property`:

```rust
use sombra::{GraphDB, PropertyValue};

let mut db = GraphDB::open("production.db")?;

// Update a single property
db.set_node_property(node_id, "status".to_string(), PropertyValue::String("active".to_string()))?;

// Update multiple properties
db.set_node_property(node_id, "last_login".to_string(), PropertyValue::Int(1234567890))?;
db.set_node_property(node_id, "verified".to_string(), PropertyValue::Bool(true))?;
```

### Removing Node Properties

Remove properties from nodes:

```rust
// Remove a property
db.remove_node_property(node_id, "temporary_flag")?;

// Check if property exists before removing
let node = db.get_node(node_id)?;
if node.properties.contains_key("deprecated_field") {
    db.remove_node_property(node_id, "deprecated_field")?;
}
```

### Property Updates in Transactions

Property updates within transactions:

```rust
let mut tx = db.begin_transaction()?;

// Update properties within transaction
tx.set_node_property(node_id, "counter".to_string(), PropertyValue::Int(42))?;
tx.remove_node_property(node_id, "old_field")?;

// Commit all changes atomically
tx.commit()?;
```

### Performance Characteristics

Property updates use **update-in-place** optimization when possible:
- **In-place update**: When the new record fits in the existing space, only one page write occurs
- **Fallback to reinsert**: When the record grows beyond available space, the system automatically falls back to delete+reinsert
- **Automatic index updates**: Property indexes are updated atomically with the property change

## Next Steps

- Read the [Production Deployment Guide]production.md for deployment specifics
- Check the [Security Guide]security.md for security best practices
- Review the [Performance Metrics]performance_metrics.md for detailed monitoring
- Browse the [examples]../examples/ for operational patterns