class Aeternitas::StorageAdapter
Storage Adapters take care of handling source files. @abstract Create a subclass and override {#store}, #{retrieve} and #{#delete} to create a new storage adapter
Public Class Methods
Create a new storage adapter @param [Hash] config the adapters configuration
# File lib/aeternitas/storage_adapter.rb, line 9 def initialize(config) @config = config end
Public Instance Methods
Delete the entry with the given fingerprint @abstract @param [String] id the entries fingerprint @return [Boolean] Operation state
# File lib/aeternitas/storage_adapter.rb, line 33 def delete(id) raise NotImplementedError, "#{self.class.name} does not implement #delete, required by Aeternitas::StorageAdapter" end
Checks whether the entry with the given fingerprint exists. @abstract @param [String] id the entries id @return [Boolean] if the entry exists
# File lib/aeternitas/storage_adapter.rb, line 41 def exist?(id) raise NotImplementedError, "#{self.class.name} does not implement #exist?, required by Aeternitas::StorageAdapter" end
Retrieves the content of the entry with the given fingerprint @abstract @param [String] id the entries fingerprint @return [String] the entries content
# File lib/aeternitas/storage_adapter.rb, line 25 def retrieve(id) raise NotImplementedError, "#{self.class.name} does not implement #retrive, required by Aeternitas::StorageAdapter" end
Store a new entry with the given id and raw content @abstract @param [String] id the entries fingerprint @param [Object] raw_content the raw content object
# File lib/aeternitas/storage_adapter.rb, line 17 def store(id, raw_content) raise NotImplementedError, "#{self.class.name} does not implement #store, required by Aeternitas::StorageAdapter" end