Class: SafeDb::Master

Inherits:
Object
  • Object
show all
Defined in:
lib/model/master.rb

Overview

This master data structure controls the key publicly visible properties for the safe database be it in a local or remote location.

This object mapper seals away details of the persistence engine involved. Who knows, it could be a local drive, an S3 bucket and even a database.

Instance Method Summary collapse

Constructor Details

#initializeMaster

Initialize an instance of this safe database’s master properties.



13
14
15
# File 'lib/model/master.rb', line 13

def initialize()
  @master = DataMap.new( Indices::MASTER_INDICES_FILEPATH )
end

Instance Method Details

#get_backend_coordinatesString

Get the coordinates (book, chapter and verse) of the verse that holds the remote backend properties. An exception will be thrown if no backend coordinates have been set.

Returns:

  • (String)

    the backend coordinates to set



22
23
24
25
# File 'lib/model/master.rb', line 22

def get_backend_coordinates()
  @master.use( Indices::REMOTE_MIRROR_SECTION_NAME )
  return @master.get( Indices::REMOTE_MIRROR_PAGE_NAME )
end

#set_backend_coordinates(backend_coordinates) ⇒ Object

Set the coordinates (book, chapter and verse) of the verse that holds the remote backend properties.

Parameters:

  • backend_coordinates (String)

    the backend coordinates to set



31
32
33
34
# File 'lib/model/master.rb', line 31

def set_backend_coordinates( backend_coordinates )
  @master.use( Indices::REMOTE_MIRROR_SECTION_NAME )
  @master.set( Indices::REMOTE_MIRROR_PAGE_NAME, backend_coordinates )
end