Class: Olelo::Repository Abstract

Inherits:
Object show all
Extended by:
Factory
Includes:
Util
Defined in:
lib/olelo/repository.rb

Overview

This class is abstract.

Abstract repository base

This class should not be used directly. Use the Page class which is implemented on top of it.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Factory

[], register, registry

Methods included from Util

#check, #decode64, #deep_copy, #encode64, #escape, #escape_html, #escape_javascript, included, #md5, #no_cache?, #sha256, #titlecase, #truncate, #unescape, #unescape_backslash, #unescape_html, #valid_xml_chars?, #yaml_dump, #yaml_load, #yaml_load_file

Class Method Details

.instanceObject



59
60
61
# 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

Instance Method Details

#commit(comment) ⇒ Version

Commit changes with a comment

This method can only be used within a #transaction block.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


126
127
128
# File 'lib/olelo/repository.rb', line 126

def commit(comment)
  raise NotImplementedError
end

#delete(path) ⇒ void

This method returns an undefined value.

Delete path

This method can only be used within a #transaction block.

Parameters:

Raises:

  • (NotImplementedError)


115
116
117
# File 'lib/olelo/repository.rb', line 115

def delete(path)
  raise NotImplementedError
end

#diff(path, from, to) ⇒ Object

Difference between versions for path

Parameters:

Raises:

  • (NotImplementedError)


208
209
210
# File 'lib/olelo/repository.rb', line 208

def diff(path, from, to)
  raise NotImplementedError
end

#get_attributes(path, version) ⇒ Hash

Get attributes

Parameters:

Returns:

  • (Hash)

    attribute hash

Raises:

  • (NotImplementedError)


198
199
200
# File 'lib/olelo/repository.rb', line 198

def get_attributes(path, version)
  raise NotImplementedError
end

#get_children(path, version) ⇒ Array<String>

Get children of path

Parameters:

Returns:

  • (Array<String>)

    Names of children

Raises:

  • (NotImplementedError)


178
179
180
# File 'lib/olelo/repository.rb', line 178

def get_children(path, version)
  raise NotImplementedError
end

#get_content(path, version) ⇒ String

Get content

Parameters:

Returns:

Raises:

  • (NotImplementedError)


188
189
190
# File 'lib/olelo/repository.rb', line 188

def get_content(path, version)
  raise NotImplementedError
end

#get_history(path, skip, limit) ⇒ Array<Version>

Get history of path beginning with newest version

Parameters:

  • path (String)
  • Number (Integer)

    of versions to skip

  • Maximum (Integer)

    number of versions to load

Returns:

Raises:

  • (NotImplementedError)


158
159
160
# File 'lib/olelo/repository.rb', line 158

def get_history(path, skip, limit)
  raise NotImplementedError
end

#get_path_version(path, version) ⇒ Array<Version>

Get versions of path

Parameters:

Returns:

  • (Array<Version>)

    Tuple: previous version, current version, next version

Raises:

  • (NotImplementedError)


168
169
170
# File 'lib/olelo/repository.rb', line 168

def get_path_version(path, version)
  raise NotImplementedError
end

#get_version(version = nil) ⇒ Version

Find version by version id

Returns head version if no version is given

Parameters:

  • version (String) (defaults to: nil)

Returns:

Raises:

  • (NotImplementedError)


147
148
149
# File 'lib/olelo/repository.rb', line 147

def get_version(version = nil)
  raise NotImplementedError
end

#move(path, destination) ⇒ void

This method returns an undefined value.

Move path

This method can only be used within a #transaction block.

Parameters:

Raises:

  • (NotImplementedError)


105
106
107
# File 'lib/olelo/repository.rb', line 105

def move(path, destination)
  raise NotImplementedError
end

#path_etag(path, version) ⇒ String

Check if path exists and return etag

Parameters:

Returns:

Raises:

  • (NotImplementedError)


136
137
138
# File 'lib/olelo/repository.rb', line 136

def path_etag(path, version)
  raise NotImplementedError
end

#set_attributes(path, attributes) ⇒ void

This method returns an undefined value.

Set attributes of path

This method can only be used within a #transaction block.

Parameters:

Raises:

  • (NotImplementedError)


94
95
96
# File 'lib/olelo/repository.rb', line 94

def set_attributes(path, attributes)
  raise NotImplementedError
end

#set_content(path, content) ⇒ void

This method returns an undefined value.

Set content of path

This method can only be used within a #transaction block.

Parameters:

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/olelo/repository.rb', line 82

def set_content(path, content)
  raise NotImplementedError
end

#short_version(version) ⇒ String

Shortens given version id

Parameters:

  • long (String)

    version id

Returns:

  • (String)

    shortened version id



217
218
219
# File 'lib/olelo/repository.rb', line 217

def short_version(version)
  version
end

#transaction { ... } ⇒ void

This method returns an undefined value.

Wrap block in transaction

Every write operation has to be wrapped in a transaction.

Yields:

  • Transaction block

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/olelo/repository.rb', line 70

def transaction
  raise NotImplementedError
end