Class: Replication::Replica

Inherits:
Object
  • Object
show all
Defined in:
lib/replication/replica.rb

Overview

Note:

Copyright © 2014 by The Board of Trustees of the Leland Stanford Junior University. All rights reserved. See LICENSE for details.

The metadata concerning the digital object/version that is the subject of replication.

Constant Summary collapse

@@replica_cache_pathname =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(replica_id, home_repository) ⇒ Replica

Returns Initialize a new Replica object.

Parameters:

  • replica_id (String)

    The unique identifier for the digital object replica

  • home_repository (String)

    The original home location of the replica (sdr or dpn)



49
50
51
52
# File 'lib/replication/replica.rb', line 49

def initialize(replica_id, home_repository)
  @replica_id = replica_id
  @home_repository = home_repository
end

Instance Attribute Details

#bagit_bagBagitBag

Returns A bag containing a copy of the replica.

Returns:

  • (BagitBag)

    A bag containing a copy of the replica



35
36
37
# File 'lib/replication/replica.rb', line 35

def bagit_bag
  @bagit_bag
end

#create_dateTime

Returns The timestamp of the datetime at which the replica was created.

Returns:

  • (Time)

    The timestamp of the datetime at which the replica was created



32
33
34
# File 'lib/replication/replica.rb', line 32

def create_date
  @create_date
end

#home_repositoryString

Returns The original home location of the replica (sdr or dpn).

Returns:

  • (String)

    The original home location of the replica (sdr or dpn)



29
30
31
# File 'lib/replication/replica.rb', line 29

def home_repository
  @home_repository
end

#payload_fixityString

Returns The value of the checksum/digest.

Returns:

  • (String)

    The value of the checksum/digest



44
45
46
# File 'lib/replication/replica.rb', line 44

def payload_fixity
  @payload_fixity
end

#payload_fixity_typeString

Returns The type of checksum/digest type (:sha1, :sha256).

Returns:

  • (String)

    The type of checksum/digest type (:sha1, :sha256)



41
42
43
# File 'lib/replication/replica.rb', line 41

def payload_fixity_type
  @payload_fixity_type
end

#payload_sizeInteger

Returns The size (in bytes) of the replic bag’s payload.

Returns:

  • (Integer)

    The size (in bytes) of the replic bag’s payload



38
39
40
# File 'lib/replication/replica.rb', line 38

def payload_size
  @payload_size
end

#replica_idString

Returns The unique identifier for the digital object replica.

Returns:

  • (String)

    The unique identifier for the digital object replica



26
27
28
# File 'lib/replication/replica.rb', line 26

def replica_id
  @replica_id
end

Class Method Details

.replica_cache_pathnamePathname

Returns The base location of the replica cache.

Returns:

  • (Pathname)

    The base location of the replica cache



15
16
17
# File 'lib/replication/replica.rb', line 15

def Replica.replica_cache_pathname
  @@replica_cache_pathname
end

.replica_cache_pathname=(replica_cache_pathname) ⇒ Pathname

Returns Set the base location of the replica cache.

Parameters:

  • replica_cache_pathname (Pathname, String)

    The base location of the replica cache

Returns:

  • (Pathname)

    Set the base location of the replica cache



21
22
23
# File 'lib/replication/replica.rb', line 21

def Replica.replica_cache_pathname=(replica_cache_pathname)
  @@replica_cache_pathname = Pathname(replica_cache_pathname)
end

Instance Method Details

#replica_pathnamePathname

Returns The location of the replica bag.

Returns:

  • (Pathname)

    The location of the replica bag



55
56
57
# File 'lib/replication/replica.rb', line 55

def replica_pathname
  @replica_pathname ||= @@replica_cache_pathname.join(home_repository,replica_id)
end