Class: StrokeDB::ChunkStorage

Inherits:
Object
  • Object
show all
Includes:
ChainableStorage
Defined in:
lib/stores/skiplist_store/chunk_storage.rb

Direct Known Subclasses

FileChunkStorage, MemoryChunkStorage

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ChainableStorage

#add_chained_storage!, #has_chained_storage?, #remove_chained_storage!, #save_with_chained_storages!, #save_without_chained_storages!, #sync_chained_storage!, #sync_chained_storages!

Constructor Details

#initialize(opts = {}) ⇒ ChunkStorage

Returns a new instance of ChunkStorage.



7
8
# File 'lib/stores/skiplist_store/chunk_storage.rb', line 7

def initialize(opts={})
end

Instance Attribute Details

#authoritative_sourceObject

Returns the value of attribute authoritative_source.



5
6
7
# File 'lib/stores/skiplist_store/chunk_storage.rb', line 5

def authoritative_source
  @authoritative_source
end

Instance Method Details

#find(uuid) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/stores/skiplist_store/chunk_storage.rb', line 10

def find(uuid)
  unless result = read(chunk_path(uuid)) 
    if authoritative_source
      result = authoritative_source.find(uuid) 
      save!(result, authoritative_source) if result
    end
  end
  result
end