slatedb 0.4.4-aarch64-linux → 0.6.1-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68154d73d7a14d2f9a123f14934a9eb8078309925de1f729dabc8b235db90d00
4
- data.tar.gz: 876a2e026b98ec3a712acf9c8398fbfd551fde2b610e5b2a2ac76140a0c2f4a0
3
+ metadata.gz: f94b5f32f05b9d21536aa9441c17e42539db489eae97aa46556f35dfa699b7dd
4
+ data.tar.gz: 1620d5a46e797daf8de95d821415be96a5fc6c80e4f97a278b07a1032ae1c240
5
5
  SHA512:
6
- metadata.gz: 1d71b6e1c6192789e7f66bb532c5b34706fe57a23cc34de57d8f4c0df4a9cc8a6653260fe82f9c8817ead19ffec9c531af8d3284cbc3a4c5ca7932c6de7f6bf1
7
- data.tar.gz: fe43746af4e69f5336948a8196bba3f5fc07a9338dfba5f643aabf93cd71e972d054a66471cb4bd58fdf1ac93437c4a12624365c5c67ba2ac25ebb92577059a1
6
+ metadata.gz: ce0bef97705696cf225053c27f088e5c3dabe30f0d05f358e7a71d405e39fe2b7f864c5d0d29e57f74636e6d7eb1319ed05b9d12eed107dfc8410c86e4c4cafa
7
+ data.tar.gz: cf8eaa8427cdd8d9346635fe7c1463cf5be0a05256da13e3679105e371d5cc7c82e383c357c7c0dd092f0f745581ac4e0b4ef1404967a07631ec1d95542e00cf
data/README.md CHANGED
@@ -64,6 +64,34 @@ SlateDb::Database.open("/tmp/mydb") do |db|
64
64
  end # automatically closed
65
65
  ```
66
66
 
67
+ ### Compaction Controls
68
+
69
+ SlateDB 0.17 adds controls for how long compaction inputs remain protected from
70
+ garbage collection and when to consolidate sorted runs:
71
+
72
+ ```ruby
73
+ SlateDb::Database.open("mydb",
74
+ url: "s3://mybucket/path",
75
+ compactor_checkpoint_lifetime: 30 * 60_000,
76
+ sorted_run_consolidation_threshold: 8) do |db|
77
+ db.put("key", "value")
78
+ end
79
+ ```
80
+
81
+ `compactor_checkpoint_lifetime` is in milliseconds and defaults to 15 minutes.
82
+ Reads, scans, snapshots, and transactions using old compaction inputs must finish
83
+ within that time; after it expires, garbage collection can remove those inputs.
84
+
85
+ `sorted_run_consolidation_threshold` starts fallback consolidation when the
86
+ projected sorted-run count exceeds the threshold. It is not a hard limit.
87
+ Zero disables it (the default); use at least two to enable it. SlateDB warns and
88
+ disables the trigger for one. Low thresholds can increase storage reads and writes.
89
+
90
+ ### Key Size
91
+
92
+ Keys can now exceed the previous 65,535-byte limit, up to SlateDB's new
93
+ 4,294,967,295-byte limit. Very large keys still require enough memory to process.
94
+
67
95
  ### Persistent Storage
68
96
 
69
97
  For persistent storage, provide an object store URL:
@@ -501,6 +529,14 @@ SlateDb::Reader.open("/tmp/mydb", url: "s3://bucket/path") do |reader|
501
529
  reader.scan("prefix:").each do |k, v|
502
530
  puts "#{k}: #{v}"
503
531
  end
532
+
533
+ # Range and prefix scans accept :asc/:ascending or :desc/:descending.
534
+ reader.scan("user:100", "user:200", order: :desc).each do |k, v|
535
+ puts "#{k}: #{v}"
536
+ end
537
+ reader.scan_prefix("user:", from: "100", to: "200", order: :desc).each do |k, v|
538
+ puts "#{k}: #{v}"
539
+ end
504
540
  end
505
541
 
506
542
  # Open at a specific checkpoint (pins the reader to that checkpoint's state)
@@ -561,8 +597,19 @@ admin.run_gc(min_age: 3600_000) # Set min age for all directorie
561
597
  admin.run_gc(manifest_min_age: 86400_000) # Custom age for manifest (1 day)
562
598
  admin.run_gc(wal_min_age: 60_000) # Custom age for WAL (1 minute)
563
599
  admin.run_gc(compacted_min_age: 60_000) # Custom age for compacted (1 minute)
600
+
601
+ # Delete a database (SlateDB >= 0.16.0)
602
+ would_delete = admin.delete_db # Dry run: returns the object paths
603
+ # that *would* be deleted, deleting nothing
604
+ deleted = admin.delete_db(confirm: true) # Actually delete; returns the removed paths
564
605
  ```
565
606
 
607
+ `delete_db` is idempotent, and a confirmed delete of a directory that is not a
608
+ SlateDB database (no manifest and no in-progress deletion marker) is refused, so
609
+ a mistyped path cannot wipe an unrelated directory. For a cloned database, any
610
+ checkpoints it pinned in parent databases are stripped before its own objects
611
+ are removed.
612
+
566
613
  ### Flushing
567
614
 
568
615
  Ensure all writes are persisted:
@@ -572,6 +619,26 @@ db.put("key", "value")
572
619
  db.flush
573
620
  ```
574
621
 
622
+ By default, `flush` flushes the write-ahead log (WAL) if enabled, otherwise the
623
+ memtable. You can choose explicitly with `flush_type:` (SlateDB >= 0.16.0):
624
+
625
+ ```ruby
626
+ db.flush(flush_type: :wal) # Flush the write-ahead log
627
+ db.flush(flush_type: :memtable) # Freeze and flush memtable entries to object storage
628
+ ```
629
+
630
+ ### Closing
631
+
632
+ Closing flushes the active memtable first by default, so durable writes are not
633
+ lost. You can control the final flush when closing (SlateDB >= 0.16.0):
634
+
635
+ ```ruby
636
+ db.close # Flush the memtable, then close (default)
637
+ db.close(flush_type: :wal) # Flush the WAL before closing
638
+ db.close(flush: false) # Close without a final flush; writes that are not
639
+ # yet durable may be lost
640
+ ```
641
+
575
642
  ## Thread Safety
576
643
 
577
644
  **SlateDB is fully thread-safe and optimized for concurrent access.**
Binary file
Binary file
Binary file
data/lib/slatedb/admin.rb CHANGED
@@ -118,5 +118,33 @@ module SlateDb
118
118
  opts[:min_age] = min_age if min_age
119
119
  _run_gc(opts)
120
120
  end
121
+
122
+ # Delete a database, removing its objects from the object store
123
+ # (SlateDB >= 0.16.0).
124
+ #
125
+ # For a cloned database, any checkpoints it pinned in parent databases are
126
+ # stripped before its own objects are removed.
127
+ #
128
+ # By default this performs a dry run: it returns the object paths that
129
+ # *would* be deleted without removing anything. Pass +confirm: true+ to
130
+ # actually delete. A confirmed delete of a directory that is not a SlateDB
131
+ # database (no manifest and no in-progress deletion marker) is refused, so a
132
+ # mistyped path cannot wipe an unrelated directory. The operation is
133
+ # idempotent.
134
+ #
135
+ # @param confirm [Boolean] When false (the default), performs a dry run and
136
+ # returns the paths that would be deleted. When true, deletes and returns
137
+ # the paths that were removed.
138
+ # @return [Array<String>] Object paths deleted (or that would be deleted)
139
+ #
140
+ # @example Preview what would be deleted
141
+ # admin.delete_db.each { |path| puts path }
142
+ #
143
+ # @example Actually delete the database
144
+ # deleted = admin.delete_db(confirm: true)
145
+ #
146
+ def delete_db(confirm: false)
147
+ _delete_db(confirm)
148
+ end
121
149
  end
122
150
  end
@@ -12,6 +12,12 @@ module SlateDb
12
12
  # @param merge_operator [Symbol, String, Proc, nil] Optional merge operator.
13
13
  # Can be a symbol/string ("string_concat" or "concat") or a Proc/lambda
14
14
  # that takes (key, existing_value, new_value) and returns the merged value.
15
+ # @param compactor_checkpoint_lifetime [Integer, nil] How long compaction inputs
16
+ # are protected from garbage collection, in milliseconds (default: 15 minutes).
17
+ # Reads using those inputs must finish within this time.
18
+ # @param sorted_run_consolidation_threshold [Integer, nil] Sorted-run count above
19
+ # which fallback consolidation starts. Zero disables it (default); use at least
20
+ # two to enable it. One is disabled by SlateDB with a warning. This is not a hard limit.
15
21
  # @yield [db] If a block is given, yields the database and ensures it's closed
16
22
  # @return [Database] The opened database (or block result if block given)
17
23
  #
@@ -38,8 +44,12 @@ module SlateDb
38
44
  # db.merge("counter", "3")
39
45
  # db.get("counter") # => "8"
40
46
  #
41
- def open(path, url: nil, merge_operator: nil)
42
- opts = {}
47
+ def open(path, url: nil, merge_operator: nil,
48
+ compactor_checkpoint_lifetime: nil, sorted_run_consolidation_threshold: nil)
49
+ opts = {
50
+ compactor_checkpoint_lifetime: compactor_checkpoint_lifetime,
51
+ sorted_run_consolidation_threshold: sorted_run_consolidation_threshold
52
+ }.compact
43
53
 
44
54
  case merge_operator
45
55
  when Symbol, String
@@ -506,5 +516,63 @@ module SlateDb
506
516
  def metrics
507
517
  _metrics
508
518
  end
519
+
520
+ # Flush in-memory writes to object storage.
521
+ #
522
+ # With no arguments this flushes pending writes durably, matching the
523
+ # previous behavior. Pass +flush_type+ to control what is flushed
524
+ # (SlateDB >= 0.16.0).
525
+ #
526
+ # @param flush_type [Symbol, String, nil] Which data to flush: :wal to flush
527
+ # the write-ahead log, or :memtable to freeze and flush memtable entries
528
+ # to object storage. When nil (the default), SlateDB flushes the WAL if
529
+ # enabled, otherwise the memtable.
530
+ # @return [void]
531
+ #
532
+ # @example Flush pending writes
533
+ # db.flush
534
+ #
535
+ # @example Explicitly flush the WAL
536
+ # db.flush(flush_type: :wal)
537
+ #
538
+ def flush(flush_type: nil)
539
+ if flush_type.nil?
540
+ _flush
541
+ else
542
+ _flush_with_options(flush_type.to_s)
543
+ end
544
+ end
545
+
546
+ # Close the database.
547
+ #
548
+ # By default the active memtable is flushed before closing (matching the
549
+ # previous behavior). Pass +flush: false+ to close without a final flush,
550
+ # in which case writes that are not yet durable may be lost
551
+ # (SlateDB >= 0.16.0).
552
+ #
553
+ # @param flush [Boolean] Whether to flush before closing (default: true)
554
+ # @param flush_type [Symbol, String, nil] When flushing, which data to
555
+ # flush: :wal or :memtable. Defaults to :memtable. Ignored when
556
+ # +flush: false+.
557
+ # @return [void]
558
+ #
559
+ # @example Close (flushing the memtable first)
560
+ # db.close
561
+ #
562
+ # @example Close without flushing
563
+ # db.close(flush: false)
564
+ #
565
+ # @example Flush the WAL before closing
566
+ # db.close(flush_type: :wal)
567
+ #
568
+ def close(flush: true, flush_type: nil)
569
+ if !flush
570
+ _close_with_options(nil)
571
+ elsif flush_type.nil?
572
+ _close
573
+ else
574
+ _close_with_options(flush_type.to_s)
575
+ end
576
+ end
509
577
  end
510
578
  end
@@ -106,16 +106,19 @@ module SlateDb
106
106
  #
107
107
  # @param start_key [String] The start key (inclusive)
108
108
  # @param end_key [String, nil] The end key (exclusive)
109
+ # @param order [Symbol, String, nil] Iteration order (:asc/:ascending or :desc/:descending)
109
110
  # @return [Iterator] An iterator over key-value pairs
110
111
  #
111
112
  def scan(start_key, end_key = nil, durability_filter: nil, dirty: nil,
112
- read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil, &)
113
- opts = {}
114
- opts[:durability_filter] = durability_filter.to_s if durability_filter
115
- opts[:dirty] = dirty unless dirty.nil?
116
- opts[:read_ahead_bytes] = read_ahead_bytes if read_ahead_bytes
117
- opts[:cache_blocks] = cache_blocks unless cache_blocks.nil?
118
- opts[:max_fetch_tasks] = max_fetch_tasks if max_fetch_tasks
113
+ read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil, order: nil, &)
114
+ opts = {
115
+ durability_filter: durability_filter&.to_s,
116
+ dirty: dirty,
117
+ read_ahead_bytes: read_ahead_bytes,
118
+ cache_blocks: cache_blocks,
119
+ max_fetch_tasks: max_fetch_tasks,
120
+ order: order&.to_s
121
+ }.compact
119
122
 
120
123
  iter = if opts.empty?
121
124
  _scan(start_key, end_key)
@@ -138,6 +141,7 @@ module SlateDb
138
141
  # @param read_ahead_bytes [Integer, nil] Number of bytes to read ahead
139
142
  # @param cache_blocks [Boolean, nil] Whether to cache blocks
140
143
  # @param max_fetch_tasks [Integer, nil] Maximum number of fetch tasks
144
+ # @param order [Symbol, String, nil] Iteration order (:asc/:ascending or :desc/:descending)
141
145
  # @param from [String, nil] Inclusive lower bound suffix, appended to the
142
146
  # prefix, to start scanning from (e.g. prefix "user:" with from "100"
143
147
  # starts at "user:100"). Defaults to the start of the prefix.
@@ -146,7 +150,7 @@ module SlateDb
146
150
  # @return [Iterator] An iterator over key-value pairs
147
151
  #
148
152
  def scan_prefix(prefix, durability_filter: nil, dirty: nil,
149
- read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil,
153
+ read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil, order: nil,
150
154
  from: nil, to: nil, &)
151
155
  opts = {
152
156
  durability_filter: durability_filter&.to_s,
@@ -154,6 +158,7 @@ module SlateDb
154
158
  read_ahead_bytes: read_ahead_bytes,
155
159
  cache_blocks: cache_blocks,
156
160
  max_fetch_tasks: max_fetch_tasks,
161
+ order: order&.to_s,
157
162
  subrange_from: from,
158
163
  subrange_to: to
159
164
  }.compact
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SlateDb
4
- VERSION = "0.4.4"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slatedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.6.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - SlateDB Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-03 00:00:00.000000000 Z
11
+ date: 2026-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.86'
61
+ version: '1.92'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.86'
68
+ version: '1.92'
69
69
  description: A cloud-native embedded key-value store built on object storage
70
70
  email:
71
71
  - slatedb@example.com