Skip to content
This repository
Browse code

update documentation

[ci skip]
  • Loading branch information...
commit e3a3a5f9aacc3ff6257619d1024d5cfc67213e09 1 parent 664398f
Daniel Mendler authored December 27, 2012

Showing 33 changed files with 29 additions and 96 deletions. Show diff stats Hide diff stats

  1. 1  .yardopts
  2. 36  CHANGES
  3. 14  SPEC.md
  4. 2  lib/moneta/adapters/activerecord.rb
  5. 4  lib/moneta/adapters/cassandra.rb
  6. 2  lib/moneta/adapters/client.rb
  7. 2  lib/moneta/adapters/couch.rb
  8. 2  lib/moneta/adapters/datamapper.rb
  9. 2  lib/moneta/adapters/dbm.rb
  10. 2  lib/moneta/adapters/file.rb
  11. 2  lib/moneta/adapters/fog.rb
  12. 2  lib/moneta/adapters/gdbm.rb
  13. 2  lib/moneta/adapters/hbase.rb
  14. 2  lib/moneta/adapters/leveldb.rb
  15. 2  lib/moneta/adapters/localmemcache.rb
  16. 2  lib/moneta/adapters/lruhash.rb
  17. 4  lib/moneta/adapters/memcached/dalli.rb
  18. 4  lib/moneta/adapters/memcached/native.rb
  19. 2  lib/moneta/adapters/mongo.rb
  20. 2  lib/moneta/adapters/pstore.rb
  21. 4  lib/moneta/adapters/redis.rb
  22. 2  lib/moneta/adapters/riak.rb
  23. 2  lib/moneta/adapters/sdbm.rb
  24. 2  lib/moneta/adapters/sequel.rb
  25. 2  lib/moneta/adapters/sqlite.rb
  26. 2  lib/moneta/adapters/tokyocabinet.rb
  27. 2  lib/moneta/expires.rb
  28. 2  lib/moneta/lock.rb
  29. 2  lib/moneta/logger.rb
  30. 2  lib/moneta/proxy.rb
  31. 2  lib/moneta/server.rb
  32. 2  lib/moneta/shared.rb
  33. 8  lib/moneta/transformer.rb
1  .yardopts
... ...
@@ -0,0 +1 @@
  1
+- README.md SPEC.md CHANGES LICENSE
36  CHANGES
... ...
@@ -1,29 +1,29 @@
1 1
 master
2 2
 
3  
-  * Renamed WithOptions to OptionSupport
4  
-  * Refactored Base in Defaults mixin
5  
-  * Removed Transformer option :quiet
6  
-  * Transformer might raise an exception if an invalid value is transformed
7  
-  * Expires middleware only wraps Arrays and nils in an Array if
8  
-    no expiration time is given (backward compatible change)
9  
-  * Moneta middlewares are not allowed to transform option hash given to functions
10  
-    like #load and #store
  3
+* Renamed WithOptions to OptionSupport
  4
+* Refactored Base in Defaults mixin
  5
+* Removed Transformer option :quiet
  6
+* Transformer might raise an exception if an invalid value is transformed
  7
+* Expires middleware only wraps Arrays and nils in an Array if
  8
+  no expiration time is given (backward compatible change)
  9
+* Moneta middlewares are not allowed to transform option hash given to functions
  10
+  like #load and #store
11 11
 
12 12
 0.7.1
13 13
 
14  
-  * Memcached: Use binary protocol and no base64 encoding of the keys
15  
-  * Transformer: Remove newlines from base64 encodes values
16  
-  * Server: Add method #run which will block and #running? to allow forking
17  
-  * SDBM: #store might raise errors (Don't use SDBM, it is unstable!)
18  
-  * Add #decrement method
19  
-  * Fix #fetch to handle false correctly
20  
-  * Fix Expires middleware to handle boolean and nil values correctly
21  
-  * Base64 encode Riak keys since Riak needs valid UTF-8 for the REST interface
  14
+* Memcached: Use binary protocol and no base64 encoding of the keys
  15
+* Transformer: Remove newlines from base64 encodes values
  16
+* Server: Add method #run which will block and #running? to allow forking
  17
+* SDBM: #store might raise errors (Don't use SDBM, it is unstable!)
  18
+* Add #decrement method
  19
+* Fix #fetch to handle false correctly
  20
+* Fix Expires middleware to handle boolean and nil values correctly
  21
+* Base64 encode Riak keys since Riak needs valid UTF-8 for the REST interface
22 22
 
23 23
 0.7.0
24 24
 
25  
-  * Major rewrite by Daniel Mendler
  25
+* Major rewrite by Daniel Mendler
26 26
 
27 27
 0.6.0
28 28
 
29  
-  * First public release by Yehuda Katz
  29
+* First public release by Yehuda Katz
14  SPEC.md
Source Rendered
... ...
@@ -1,16 +1,8 @@
1 1
 # Moneta Specification
2 2
 
3  
-The purpose of the moneta specification is to create a general-purpose API for interacting with key-value stores. In general, libraries that need to interact with key-value stores should be able to specify that they can use any "moneta-compliant store".
4  
-
5  
-# Moneta Executable Specs
6  
-
7  
-Moneta ships with a set of executable specs which you can use to verify spec-compliance with your moneta adapter.
8  
-
9  
-# Requirements for a Moneta Adapter
10  
-
11 3
 (See RFC 2119 for use of MUST, SHOULD, MAY, MUST NOT, and SHOULD NOT)
12 4
 
13  
-A Moneta adapter must expose a class with the following characteristics:
  5
+The purpose of the moneta specification is to create a general-purpose API for interacting with key-value stores. In general, libraries that need to interact with key-value stores should be able to specify that they can use any "moneta-compliant store". Moneta ships with a set of executable specs which you can use to verify spec-compliance with your moneta adapter.
14 6
 
15 7
 ## Class Methods
16 8
 
@@ -62,7 +54,7 @@ This method MUST accept negative values, but the result MUST be unsigned.
62 54
 
63 55
 Completely empty all keys and values from the key-value-store. Adapters MAY allow a namespace during initialization, which can scope this operation to a particular subset of keys. After calling <code>clear</code>, a <code>[]</code> operation MUST return nil for every possible key, and a <code>key?</code> query MUST return false for every possible key.
64 56
 
65  
-# Additional Options Hashes
  57
+## Additional Options Hashes
66 58
 
67 59
 The following methods may all take an additional Hash as a final argument. This allows the client to send additional options which can be specified by the adapter (and which may be specified by extensions to this specification). The methods MUST NOT modify the supplied option hash.
68 60
 
@@ -76,6 +68,6 @@ The following methods may all take an additional Hash as a final argument. This
76 68
 
77 69
 In the case of methods with optional arguments, the Hash MUST be provided as the final argument. Keys in this Hash MUST be Symbols.
78 70
 
79  
-# Atomicity
  71
+## Atomicity
80 72
 
81 73
 The base Moneta specification does not specify any atomicity guarantees. However, extensions to this spec may specify extensions that define additional guarantees for any of the defined operations.
2  lib/moneta/adapters/activerecord.rb
@@ -13,8 +13,6 @@ def self.tables
13 13
 
14 14
       attr_reader :table
15 15
 
16  
-      # Constructor
17  
-      #
18 16
       # @param [Hash] options
19 17
       # @option options [String] :table ('moneta') Table name
20 18
       # @option options [Hash]   :connection ActiveRecord connection configuration
4  lib/moneta/adapters/cassandra.rb
@@ -10,14 +10,12 @@ module Adapters
10 10
     class Cassandra
11 11
       include Defaults
12 12
 
13  
-      # Constructor
14  
-      #
15 13
       # @param [Hash] options
16 14
       # @option options [String] :keyspace ('moneta') Cassandra keyspace
17 15
       # @option options [String] :column_family ('moneta') Cassandra column family
18 16
       # @option options [String] :host ('127.0.0.1') Server host name
19 17
       # @option options [Integer] :port (9160) Server port
20  
-      # @option options [String] :expires Default expiration time
  18
+      # @option options [Integer] :expires Default expiration time
21 19
       def initialize(options = {})
22 20
         options[:host] ||= '127.0.0.1'
23 21
         options[:port] ||=  9160
2  lib/moneta/adapters/client.rb
@@ -8,8 +8,6 @@ class Client
8 8
       include Net
9 9
       include Defaults
10 10
 
11  
-      # Constructor
12  
-      #
13 11
       # @param [Hash] options
14 12
       # @option options [Integer] :port (9000) TCP port
15 13
       # @option options [String] :host ('127.0.0.1') Hostname
2  lib/moneta/adapters/couch.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class Couch
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :db ('moneta') Couch database
14 12
       def initialize(options = {})
2  lib/moneta/adapters/datamapper.rb
@@ -14,8 +14,6 @@ class Store
14 14
         property :v, Text, :lazy => false
15 15
       end
16 16
 
17  
-      # Constructor
18  
-      #
19 17
       # @param [Hash] options
20 18
       # @option options [String] :setup Datamapper setup string
21 19
       # @option options [String/Symbol] :repository (:moneta) Repository name
2  lib/moneta/adapters/dbm.rb
@@ -5,8 +5,6 @@ module Adapters
5 5
     # DBM backend (Berkeley DB)
6 6
     # @api public
7 7
     class DBM < Memory
8  
-      # Constructor
9  
-      #
10 8
       # @param [Hash] options
11 9
       # @option options [String] :file Database file
12 10
       def initialize(options = {})
2  lib/moneta/adapters/file.rb
@@ -8,8 +8,6 @@ class File
8 8
       include Defaults
9 9
       include IncrementSupport
10 10
 
11  
-      # Constructor
12  
-      #
13 11
       # @param [Hash] options
14 12
       # @option options [String] :dir Directory where files will be stored
15 13
       def initialize(options = {})
2  lib/moneta/adapters/fog.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class Fog
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :dir Fog directory
14 12
       # @option options Other options passed to `Fog::Storage#new`
2  lib/moneta/adapters/gdbm.rb
@@ -5,8 +5,6 @@ module Adapters
5 5
     # GDBM backend
6 6
     # @api public
7 7
     class GDBM < Memory
8  
-      # Constructor
9  
-      #
10 8
       # @param [Hash] options
11 9
       # @option options [String] :file Database file
12 10
       def initialize(options = {})
2  lib/moneta/adapters/hbase.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class HBase
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :host ('127.0.0.1') Server host name
14 12
       # @option options [Integer] :port (9090) Server port
2  lib/moneta/adapters/leveldb.rb
@@ -5,8 +5,6 @@ module Adapters
5 5
     # LevelDB backend
6 6
     # @api public
7 7
     class LevelDB < Memory
8  
-      # Constructor
9  
-      #
10 8
       # @param [Hash] options
11 9
       # @option options [String] :dir - Database path
12 10
       # @option options All other options passed to `LevelDB::DB#new`
2  lib/moneta/adapters/localmemcache.rb
@@ -8,8 +8,6 @@ class LocalMemCache
8 8
       include Defaults
9 9
       include HashAdapter
10 10
 
11  
-      # Constructor
12  
-      #
13 11
       # @param [Hash] options
14 12
       # @option options [String] :file Database file
15 13
       def initialize(options = {})
2  lib/moneta/adapters/lruhash.rb
@@ -9,8 +9,6 @@ class LRUHash
9 9
       include Defaults
10 10
       include IncrementSupport
11 11
 
12  
-      # Constructor
13  
-      #
14 12
       # @param [Hash] options
15 13
       # @option options [Integer] :max_size (1024000) Maximum total byte size of hash values
16 14
       def initialize(options = {})
4  lib/moneta/adapters/memcached/dalli.rb
@@ -7,11 +7,9 @@ module Adapters
7 7
     class MemcachedDalli
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :server ('127.0.0.1:11211') Memcached server
14  
-      # @option options [String] :expires Default expiration time
  12
+      # @option options [Integer] :expires Default expiration time
15 13
       # @option options Other options passed to `Dalli::Client#new`
16 14
       def initialize(options = {})
17 15
         options[:expires_in] = options.delete(:expires)
4  lib/moneta/adapters/memcached/native.rb
@@ -7,12 +7,10 @@ module Adapters
7 7
     class MemcachedNative
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :server ('127.0.0.1:11211') Memcached server
14 12
       # @option options [String] :namespace Key namespace
15  
-      # @option options [String] :expires (604800) Default expiration time
  13
+      # @option options [Integer] :expires (604800) Default expiration time
16 14
       # @option options Other options passed to `Memcached#new`
17 15
       def initialize(options = {})
18 16
         server = options.delete(:server) || '127.0.0.1:11211'
2  lib/moneta/adapters/mongo.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class Mongo
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :collection ('moneta') MongoDB collection name
14 12
       # @option options [String] :host ('127.0.0.1') MongoDB server host
2  lib/moneta/adapters/pstore.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class PStore
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :file PStore file
14 12
       def initialize(options = {})
4  lib/moneta/adapters/redis.rb
@@ -7,10 +7,8 @@ module Adapters
7 7
     class Redis
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13  
-      # @option options [String] :expires Default expiration time
  11
+      # @option options [Integer] :expires Default expiration time
14 12
       # @option options Other options passed to `Redis#new`
15 13
       def initialize(options = {})
16 14
         @expires = options.delete(:expires)
2  lib/moneta/adapters/riak.rb
@@ -10,8 +10,6 @@ module Adapters
10 10
     class Riak
11 11
       include Defaults
12 12
 
13  
-      # Constructor
14  
-      #
15 13
       # @param [Hash] options
16 14
       # @option options [String] :bucket ('moneta') Bucket name
17 15
       # @option options [String] :content_type ('application/octet-stream') Default content type
2  lib/moneta/adapters/sdbm.rb
@@ -5,8 +5,6 @@ module Adapters
5 5
     # SDBM backend
6 6
     # @api public
7 7
     class SDBM < Memory
8  
-      # Constructor
9  
-      #
10 8
       # @param [Hash] options
11 9
       # @option options [String] :file Database file
12 10
       def initialize(options = {})
2  lib/moneta/adapters/sequel.rb
@@ -7,8 +7,6 @@ module Adapters
7 7
     class Sequel
8 8
       include Defaults
9 9
 
10  
-      # Constructor
11  
-      #
12 10
       # @param [Hash] options
13 11
       # @option options [String] :db Sequel database
14 12
       # @option options [String/Symbol] :table (:moneta) Table name
2  lib/moneta/adapters/sqlite.rb
@@ -8,8 +8,6 @@ class Sqlite
8 8
       include Defaults
9 9
       include IncrementSupport
10 10
 
11  
-      # Constructor
12  
-      #
13 11
       # @param [Hash] options
14 12
       # @option options [String] :file Database file
15 13
       # @option options [String] :table ('moneta') Table name
2  lib/moneta/adapters/tokyocabinet.rb
@@ -5,8 +5,6 @@ module Adapters
5 5
     # TokyoCabinet backend
6 6
     # @api public
7 7
     class TokyoCabinet < Memory
8  
-      # Constructor
9  
-      #
10 8
       # @param [Hash] options
11 9
       # @option options [String] :file Database file
12 10
       # @option options [Symbol] :type (:hdb) Database type (:bdb and :hdb possible)
2  lib/moneta/expires.rb
@@ -6,8 +6,6 @@ module Moneta
6 6
   #
7 7
   # @api public
8 8
   class Expires < Proxy
9  
-    # Constructor
10  
-    #
11 9
     # @param [Moneta store] adapter The underlying store
12 10
     # @param [Hash] options
13 11
     # @option options [String] :expires Default expiration time
2  lib/moneta/lock.rb
@@ -4,8 +4,6 @@ module Moneta
4 4
   # Locks the underlying stores with a Mutex
5 5
   # @api public
6 6
   class Lock < Wrapper
7  
-    # Constructor
8  
-    #
9 7
     # @param [Moneta store] adapter The underlying store
10 8
     # @param [Hash] options
11 9
     # @option options [String] :mutex (Mutex.new) Mutex object
2  lib/moneta/logger.rb
@@ -33,8 +33,6 @@ def dump(value)
33 33
       end
34 34
     end
35 35
 
36  
-    # Constructor
37  
-    #
38 36
     # @param [Moneta store] adapter The underlying store
39 37
     # @param [Hash] options
40 38
     # @option options [Object] :logger (Moneta::Logger::Format) Callable logger object
2  lib/moneta/proxy.rb
@@ -6,8 +6,6 @@ class Proxy
6 6
 
7 7
     attr_reader :adapter
8 8
 
9  
-    # Constructor
10  
-    #
11 9
     # @param [Moneta store] adapter underlying adapter
12 10
     # @param [Hash] options
13 11
     def initialize(adapter, options = {})
2  lib/moneta/server.rb
@@ -4,8 +4,6 @@ module Moneta
4 4
   # Moneta server
5 5
   # @api public
6 6
   class Server
7  
-    # Constructor
8  
-    #
9 7
     # @param [Hash] options
10 8
     # @option options [Integer] :port (9000) TCP port
11 9
     # @option options [String] :file Alternative Unix socket file name
2  lib/moneta/shared.rb
@@ -11,8 +11,6 @@ module Moneta
11 11
   #
12 12
   # @api public
13 13
   class Shared < Wrapper
14  
-    # Constructor
15  
-    #
16 14
     # @param [Hash] options
17 15
     # @option options [Integer] :port (9000) TCP port
18 16
     # @option options [String] :host Server hostname
8  lib/moneta/transformer.rb
@@ -10,19 +10,17 @@ module Moneta
10 10
   #
11 11
   # @example Bypass serialization
12 12
   #   store.store('key', 'value', :raw => true)
13  
-  #   store['key'] => Error
14  
-  #   store.load('key', :raw => true) => 'value'
  13
+  #   store['key'] # raises an Exception
  14
+  #   store.load('key', :raw => true) # returns 'value'
15 15
   #
16 16
   #   store['key'] = 'value'
17  
-  #   store.load('key', :raw => true) => "\x04\bI\"\nvalue\x06:\x06ET"
  17
+  #   store.load('key', :raw => true) # returns "\x04\bI\"\nvalue\x06:\x06ET"
18 18
   #
19 19
   # @api public
20 20
   class Transformer < Proxy
21 21
     class << self
22 22
       alias_method :original_new, :new
23 23
 
24  
-      # Constructor
25  
-      #
26 24
       # @param [Moneta store] adapter The underlying store
27 25
       # @param [Hash] options
28 26
       # @return [Transformer] new Moneta transformer

0 notes on commit e3a3a5f

Please sign in to comment.
Something went wrong with that request. Please try again.