Class: Harbor::FileStore
- Inherits:
-
Object
show all
- Defined in:
- lib/harbor/file_store.rb,
lib/harbor/file_store/file.rb,
lib/harbor/file_store/local.rb,
lib/harbor/file_store/mosso.rb,
lib/harbor/file_store/mosso/private.rb
Defined Under Namespace
Classes: File, Local, Mosso
Constant Summary
collapse
- @@registrations =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.[](name) ⇒ Object
18
19
20
|
# File 'lib/harbor/file_store.rb', line 18
def self.[](name)
file_stores[name]
end
|
.exists?(path) ⇒ Boolean
22
23
24
25
26
27
28
29
|
# File 'lib/harbor/file_store.rb', line 22
def self.exists?(path)
@@registrations.each do |registration|
if file_stores[registration].exists?(path) == true
return true
end
end
false
end
|
.file_stores ⇒ Object
14
15
16
|
# File 'lib/harbor/file_store.rb', line 14
def self.file_stores
@@file_stores ||= {}
end
|
.get(path) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/harbor/file_store.rb', line 31
def self.get(path)
@@registrations.each do |registration|
if file_stores[registration].exists?(path) == true
return file_stores[registration].get(path)
end
end
nil
end
|
.register(name, store) ⇒ Object
9
10
11
12
|
# File 'lib/harbor/file_store.rb', line 9
def self.register(name, store)
@@registrations.push name
file_stores[name] = store
end
|
Instance Method Details
#delete(path) ⇒ Object
44
45
46
|
# File 'lib/harbor/file_store.rb', line 44
def delete(path)
raise NotImplementedError.new("You must define your own implementation of FileStore#delete")
end
|
#exists?(path) ⇒ Boolean
48
49
50
|
# File 'lib/harbor/file_store.rb', line 48
def exists?(path)
raise NotImplementedError.new("You must define your own implementation of FileStore#exists?")
end
|
#local? ⇒ Boolean
Defines whether a file store is local, and thus could be directly copied rather than read and then written.
64
65
66
|
# File 'lib/harbor/file_store.rb', line 64
def local?
raise NotImplementedError.new("You must define your own implementation of FileStore#local?")
end
|
#open(path) ⇒ Object
52
53
54
|
# File 'lib/harbor/file_store.rb', line 52
def open(path)
raise NotImplementedError.new("You must define your own implementation of FileStore#open")
end
|
#put(path, file) ⇒ Object
40
41
42
|
# File 'lib/harbor/file_store.rb', line 40
def put(path, file)
raise NotImplementedError.new("You must define your own implementation of FileStore#put")
end
|
#size(path) ⇒ Object
56
57
58
|
# File 'lib/harbor/file_store.rb', line 56
def size(path)
raise NotImplementedError.new("You must define your own implementation of FileStore#size")
end
|