class Olelo::Repository
Abstract repository base
This class should not be used directly. Use the {Page} class which is implemented on top of it.
@abstract
Public Class Methods
# File lib/olelo/repository.rb, line 59 def self.instance Thread.current[:olelo_repository] ||= self[Config['repository.type']].new(Config['repository'][Config['repository.type']]) end
Public Instance Methods
Commit changes with a comment
This method can only be used within a {#transaction} block.
@param [String] comment @return [Version] New head version @api public
# File lib/olelo/repository.rb, line 126 def commit(comment) raise NotImplementedError end
Delete path
This method can only be used within a {#transaction} block.
@param [String] path @return [void]
# File lib/olelo/repository.rb, line 115 def delete(path) raise NotImplementedError end
Difference between versions for path
@param [String] path @param [Version, String] from @param [Version, String] to @api public
# File lib/olelo/repository.rb, line 208 def diff(path, from, to) raise NotImplementedError end
Get attributes
@param [String] path @param [String, Version] version @return [Hash] attribute hash @api public
# File lib/olelo/repository.rb, line 198 def get_attributes(path, version) raise NotImplementedError end
Get children of path
@param [String] path @param [String, Version] version @return [Array<String>] Names of children @api public
# File lib/olelo/repository.rb, line 178 def get_children(path, version) raise NotImplementedError end
Get content
@param [String] path @param [String, Version] version @return [String] content @api public
# File lib/olelo/repository.rb, line 188 def get_content(path, version) raise NotImplementedError end
Get history of path beginning with newest version
@param [String] path @param [Integer] Number of versions to skip @param [Integer] Maximum number of versions to load @return [Array<Version>] @api public
# File lib/olelo/repository.rb, line 158 def get_history(path, skip, limit) raise NotImplementedError end
Get versions of path
@param [String] path @param [String, Version] version @return [Array<Version>] Tuple: previous version, current version, next version @api public
# File lib/olelo/repository.rb, line 168 def get_path_version(path, version) raise NotImplementedError end
Find version by version id
Returns head version if no version is given
@param [String] version @return [Version] @api public
# File lib/olelo/repository.rb, line 147 def get_version(version = nil) raise NotImplementedError end
Move path
This method can only be used within a {#transaction} block.
@param [String] path @param [String] destination @return [void]
# File lib/olelo/repository.rb, line 105 def move(path, destination) raise NotImplementedError end
Check if path exists and return etag
@param [String] path @param [String, Version] version @return [String] @api public
# File lib/olelo/repository.rb, line 136 def path_etag(path, version) raise NotImplementedError end
Set attributes of path
This method can only be used within a {#transaction} block.
@param [String] path @param [Hash] attributes @return [void] @api public
# File lib/olelo/repository.rb, line 94 def set_attributes(path, attributes) raise NotImplementedError end
Set content of path
This method can only be used within a {#transaction} block.
@param [String] path @param [String, read] content @return [void] @api public
# File lib/olelo/repository.rb, line 82 def set_content(path, content) raise NotImplementedError end
Shortens given version id
@param [String] long version id @return [String] shortened version id @api public
# File lib/olelo/repository.rb, line 217 def short_version(version) version end
Wrap block in transaction
Every write operation has to be wrapped in a transaction.
@yield Transaction block @return [void] @api public
# File lib/olelo/repository.rb, line 70 def transaction raise NotImplementedError end