Module: StoreAgent::Node::Locker

Defined in:
lib/store_agent/node/prepend_module/locker.rb

Overview

オブジェクトの読み書き時にファイルをロックするモジュール

Instance Method Summary collapse

Instance Method Details

#chownObject



75
76
77
78
79
# File 'lib/store_agent/node/prepend_module/locker.rb', line 75

def chown(*)
  lock!(lock_mode: File::LOCK_EX, recursive: false) do
    super
  end
end

#copy(dest_path = nil) ⇒ Object

TODO コピー元を共有ロック、コピー先を排他ロックする



53
54
55
# File 'lib/store_agent/node/prepend_module/locker.rb', line 53

def copy(dest_path = nil, *)
  super
end

#createObject



21
22
23
24
25
# File 'lib/store_agent/node/prepend_module/locker.rb', line 21

def create(*)
  lock!(lock_mode: File::LOCK_EX, recursive: true) do
    super
  end
end

#delete(recursive: true) ⇒ Object



39
40
41
42
43
# File 'lib/store_agent/node/prepend_module/locker.rb', line 39

def delete(*, recursive: true)
  lock!(lock_mode: File::LOCK_EX, recursive: recursive) do
    super
  end
end

#get_metadataObject

:nodoc:



63
64
65
66
67
# File 'lib/store_agent/node/prepend_module/locker.rb', line 63

def (*) # :nodoc:
  lock!(lock_mode: File::LOCK_SH, recursive: true) do
    super
  end
end

#get_permissionsObject

:nodoc:



69
70
71
72
73
# File 'lib/store_agent/node/prepend_module/locker.rb', line 69

def get_permissions(*) # :nodoc:
  lock!(lock_mode: File::LOCK_SH, recursive: true) do
    super
  end
end

#move(dest_path = nil) ⇒ Object

TODO 移動元と移動先を排他ロックする



59
60
61
# File 'lib/store_agent/node/prepend_module/locker.rb', line 59

def move(dest_path = nil, *)
  super
end

#readObject



27
28
29
30
31
# File 'lib/store_agent/node/prepend_module/locker.rb', line 27

def read(*)
  lock!(lock_mode: File::LOCK_SH, recursive: true) do
    super
  end
end

#set_permissionObject

TODO 親階層のファイルをロックする



83
84
85
86
87
# File 'lib/store_agent/node/prepend_module/locker.rb', line 83

def set_permission(*)
  lock!(lock_mode: File::LOCK_EX, recursive: false) do
    super
  end
end

#touchObject



45
46
47
48
49
# File 'lib/store_agent/node/prepend_module/locker.rb', line 45

def touch(*)
  lock!(lock_mode: File::LOCK_SH, recursive: true) do
    super
  end
end

#unset_permissionObject

TODO 親階層のファイルをロックする



91
92
93
94
95
# File 'lib/store_agent/node/prepend_module/locker.rb', line 91

def unset_permission(*)
  lock!(lock_mode: File::LOCK_EX, recursive: false) do
    super
  end
end

#updateObject



33
34
35
36
37
# File 'lib/store_agent/node/prepend_module/locker.rb', line 33

def update(*)
  lock!(lock_mode: File::LOCK_EX, recursive: true) do
    super
  end
end