sdr-replication 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/replication/replica.rb +1 -1
- data/lib/replication/sdr_object_version.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9045400c2d3a49bd77d96453b89c29e583db186
|
4
|
+
data.tar.gz: 93c1aa92f9486602fb623345265c5bb88c75dc54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae096cda70bc1df8894a601da7b283d0b62f58e939828eba05e6ecfceb43b6ae0ba1e4fefbbd5eb8bc22a0ab6cce71c3dd4749f56488eaa78feda9e18a5d6f4b
|
7
|
+
data.tar.gz: 9622fb34001a5a062174cd5a972b98f7ef48faa970fd6888ee5478dcf8dd3c28129d445c05ffcc82c474bf86349fdb12270b7ecf60dfca67e6c9bdc67c2bcfd7
|
data/lib/replication/replica.rb
CHANGED
@@ -34,7 +34,7 @@ module Replication
|
|
34
34
|
# @return [BagitBag] A bag containing a copy of the replica
|
35
35
|
attr_accessor :bagit_bag
|
36
36
|
|
37
|
-
# @return [Integer] The size (in bytes) of the
|
37
|
+
# @return [Integer] The size (in bytes) of the replica bag's payload
|
38
38
|
attr_accessor :payload_size
|
39
39
|
|
40
40
|
# @return [String] The type of checksum/digest type (:sha1, :sha256)
|
@@ -3,6 +3,9 @@ require 'sdr_replication'
|
|
3
3
|
|
4
4
|
module Replication
|
5
5
|
|
6
|
+
class ReplicaExistsError < RuntimeError
|
7
|
+
end
|
8
|
+
|
6
9
|
#
|
7
10
|
# @note Copyright (c) 2014 by The Board of Trustees of the Leland Stanford Junior University.
|
8
11
|
# All rights reserved. See {file:LICENSE.rdoc} for details.
|
@@ -150,8 +153,10 @@ module Replication
|
|
150
153
|
end
|
151
154
|
|
152
155
|
# @return [Replica] Copy the object version into a BagIt Bag in tarfile format
|
156
|
+
# @raise [ReplicaExistsError] will not replace data in replica.bag_pathname
|
153
157
|
def create_replica
|
154
158
|
replica = self.replica
|
159
|
+
raise ReplicaExistsError if replica.bag_pathname.exist?
|
155
160
|
bag = Archive::BagitBag.create_bag(replica.bag_pathname)
|
156
161
|
bag.bag_checksum_types = [:sha256]
|
157
162
|
bag.add_payload_tarfile("#{replica.replica_id}.tar",version_pathname, storage_object.object_pathname.parent)
|