Class: COS::Checkpoint
- Inherits:
-
Struct::Base
- Object
- Struct::Base
- COS::Checkpoint
- Defined in:
- lib/cos/checkpoint.rb
Constant Summary collapse
- DEFAULT_THREADS =
默认线程数 10
10
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Checkpoint
constructor
A new instance of Checkpoint.
Methods included from Struct::Base::AttrHelper
#optional_attrs, #required_attrs
Constructor Details
#initialize(options = {}) ⇒ Checkpoint
Returns a new instance of Checkpoint.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cos/checkpoint.rb', line 12 def initialize( = {}) super() # 分片大小必须>0 if [:options] and [:options][:slice_size] and [:options][:slice_size] <= 0 raise ClientError, 'slice_size must > 0' end @mutex = Mutex.new @file_meta = {} @num_threads = [:threads] || DEFAULT_THREADS @all_mutex = Mutex.new @parts = [] @todo_mutex = Mutex.new @todo_parts = [] end |