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

instance() click to toggle source
# 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(comment) click to toggle source

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) click to toggle source

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
diff(path, from, to) click to toggle source

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(path, version) click to toggle source

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(path, version) click to toggle source

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(path, version) click to toggle source

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(path, skip, limit) click to toggle source

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_path_version(path, version) click to toggle source

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
get_version(version = nil) click to toggle source

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, destination) click to toggle source

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
path_etag(path, version) click to toggle source

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(path, attributes) click to toggle source

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(path, content) click to toggle source

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
short_version(version) click to toggle source

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
transaction() click to toggle source

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