store-digest 0.1.3 → 0.3.0

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: c6d86e00c5ff94af896658561fdc0076c17650e704dc611f4520e5580043c45a
4
- data.tar.gz: 68524ba5e9d3e253b1d3b7d589d777d617d3d360d9d7c9ed5f8cd019ff3ea2eb
3
+ metadata.gz: 7f43c259332c6cc6088efb366ad28d2147b94e8c4e1cfb5441033ebaac252243
4
+ data.tar.gz: 2a99ec000985e57084b152b760810a4aef3cc62cc11fa69429207a5258bd531c
5
5
  SHA512:
6
- metadata.gz: 713edaa0ced8d81587b276f09a9740af9f0b25f39689336cf96377a3a38c5fcf081f9b3532e1b85e8051cfaed730cca1885a68a477e5d3f5a2a3664f4d4cf3d2
7
- data.tar.gz: 7113db7fd653759cd6431e2c0c5f5ea06063daabb43ff767e93f47c942967915e54315c40d1ead17f51244e5c24f92dfb508df689977a2aad61ee527c61f87b1
6
+ metadata.gz: 93aa7826a0e4264dbf9c968616d4095b083aec7d595075a42de888988209f9e0707d6a1329d406164d9c96cd3477eb326011b52d2498bae500fb4bbc1b316b6d
7
+ data.tar.gz: 9e032440c5305f600a29b9ffb814da91212c0757c755f0ce9ba46a2d85b19c80f0f664d7ab17d073ace412bd4d0b9721ea43b35015ff4cbf7300b9d66c12674b
data/TODO.org ADDED
@@ -0,0 +1,37 @@
1
+ #+STARTUP: showall indent hidestars
2
+ * TODO upgrade metadata format
3
+ - [ ] get rid of the idea of a 'primary' digest algorithm
4
+ - [ ] change the main record to being keyed by integers and contain all hashes
5
+ - old: ≥209 bytes + 316 mapping
6
+ - new: ≥218 + 220 mapping
7
+ - [ ] make digest -> integer mapping
8
+ - [ ] add version to metadata
9
+ - [ ] add function to upgrade metadata store
10
+ * TODO add cache capability
11
+ - [ ] add fields to control:
12
+ - [ ] total bytes in cache
13
+ - [ ] total objects in cache
14
+ - [ ] cache clearing mechanism
15
+ - [ ] hook cache expiration to adding a new object
16
+ - [ ] decrement bytes and count for both cache and main data from control
17
+ - [ ] increment deleted bytes and count
18
+ - [ ] when cache is overwritten by the identical non-cache object, it does the right thing
19
+ - [ ] clear cache flag from the metadata record
20
+ - [ ] decrement cache summaries from control database
21
+ * TODO add indices
22
+ - [ ] qualitative attributes
23
+ - [ ] content-type
24
+ - [ ] language
25
+ - [ ] charset
26
+ - [ ] encoding
27
+ - [ ] time stamps
28
+ - [ ] created (record added to store)
29
+ - [ ] modified (from initial insertion)
30
+ - [ ] metadata updated
31
+ - [ ] record deleted
32
+ - [ ] index hooks
33
+ - [ ] add record
34
+ - [ ] update value
35
+ - [ ] remove record
36
+ * TODO web ui
37
+ - see [[https://github.com/doriantaylor/rb-store-digest-http][Store:::Digest::HTTP]]
@@ -10,6 +10,8 @@ module Store::Digest::Driver::LMDB
10
10
  protected
11
11
 
12
12
  def setup **options
13
+ options[:mapsize] = int_bytes options[:mapsize] if options[:mapsize]
14
+
13
15
  super
14
16
  end
15
17
  end
@@ -6,6 +6,25 @@ module Store::Digest::Driver
6
6
  # this is the only implementation we have so far
7
7
  autoload :LMDB, 'store/digest/driver/lmdb'
8
8
 
9
+ private
10
+
11
+ # for the mapsize parameter
12
+ UNITS = { nil => 1 }
13
+ 'kmgtpe'.split('').each_with_index do |x, i|
14
+ j = i + 1
15
+ UNITS[x] = 1000 ** j
16
+ UNITS[x.upcase] = 1024 ** j
17
+ end
18
+ UNITS.freeze
19
+
20
+ def int_bytes bytes
21
+ m = /\A\s*(\d+)([kmgtpeKMGTPE])?\s*\Z/s.match bytes.to_s
22
+ raise ArgumentError, "#{bytes} not a viable byte size" unless m
23
+
24
+ factor, unit = m.captures
25
+ factor.to_i * UNITS[unit]
26
+ end
27
+
9
28
  protected
10
29
 
11
30
  def setup **options