nutella_framework 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/nutella_framework.gemspec +2 -2
- data/nutella_lib/framework_persist.rb +58 -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: 690c1d9ab013743f733d0bed94daca0937123850
|
4
|
+
data.tar.gz: 55cfa3310daca7cffd7396f85a7ad0e960ce1da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7420e6cc8006fe5d664020e01b002a35a286ffa3024f8e59e77a69eab67c9a104908762ebddac071e165d76dee1d1f1d8ec0b9420ffebd1c0976f16be373a61b
|
7
|
+
data.tar.gz: 5233ea225b8a9fe2de5664270518bc4411d980b75ef6004402c68c843dc98a9e6a55e8cd0b985f9f00f4aa1c16339c889cc74dff78e87b5788bbf590091fdec6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.13
|
data/nutella_framework.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nutella_framework 0.4.
|
5
|
+
# stub: nutella_framework 0.4.13 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nutella_framework"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.13"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -12,6 +12,8 @@ module Nutella
|
|
12
12
|
# Implements basic persistence for framework-level components
|
13
13
|
module Persist
|
14
14
|
|
15
|
+
# @!group Framework-level APIs
|
16
|
+
|
15
17
|
# This method returns a MongoDB-backed store (i.e. persistence)
|
16
18
|
# for a collection (i.e. an Array)
|
17
19
|
# @param [String] name the name of the store
|
@@ -49,6 +51,62 @@ module Nutella
|
|
49
51
|
FileUtils.mkdir_p dir_path
|
50
52
|
JSONFilePersistedHash.new file_path
|
51
53
|
end
|
54
|
+
|
55
|
+
# @!endgroup
|
56
|
+
|
57
|
+
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
58
|
+
|
59
|
+
# @!group Run-level APIs
|
60
|
+
|
61
|
+
# This method returns a MongoDB-backed store
|
62
|
+
# for a collection at the run level
|
63
|
+
# @param [String] app_id
|
64
|
+
# @param [String] run_id
|
65
|
+
# @param [String] name the name of the store
|
66
|
+
# @return [MongoPersistedCollection] a MongoDB-backed collection store
|
67
|
+
def self.get_run_mongo_collection_store( app_id, run_id, name )
|
68
|
+
MongoPersistedCollection.new Nutella.mongo_host, app_id, "#{run_id}/#{name}"
|
69
|
+
end
|
70
|
+
|
71
|
+
# This method returns a MongoDB-backed store
|
72
|
+
# for a single object at the run level
|
73
|
+
# @param [String] app_id
|
74
|
+
# @param [String] run_id
|
75
|
+
# @param [String] name the name of the store
|
76
|
+
# @return [MongoPersistedHash] a MongoDB-backed Hash store
|
77
|
+
def self.get_run_mongo_object_store( app_id, run_id, name )
|
78
|
+
MongoPersistedHash.new Nutella.mongo_host, app_id, 'run_persisted_hashes', "#{run_id}/#{name}"
|
79
|
+
end
|
80
|
+
|
81
|
+
# This method returns a JSON-file-backed store
|
82
|
+
# for a collection at the run level
|
83
|
+
# @param [String] app_id
|
84
|
+
# @param [String] run_id
|
85
|
+
# @param [String] name the name of the store
|
86
|
+
# @return [JSONFilePersistedCollection] a JSON-file-backed collection store
|
87
|
+
def self.get_run_json_collection_store( app_id, run_id, name )
|
88
|
+
dir_path = "#{ENV['HOME']}/.nutella/data/#{Nutella.component_id}/#{app_id}/#{run_id}"
|
89
|
+
file_path = "#{dir_path}/#{name}.json"
|
90
|
+
FileUtils.mkdir_p dir_path
|
91
|
+
JSONFilePersistedCollection.new file_path
|
92
|
+
end
|
93
|
+
|
94
|
+
# This method returns a JSON-file-backed store
|
95
|
+
# for a single object at the run level
|
96
|
+
# @param [String] app_id
|
97
|
+
# @param [String] run_id
|
98
|
+
# @param [String] name the name of the store
|
99
|
+
# @return [JSONFilePersistedHash] a JSON-file-backed Hash store
|
100
|
+
def self.get_run_json_object_store( app_id, run_id, name )
|
101
|
+
dir_path = "#{ENV['HOME']}/.nutella/data/#{Nutella.component_id}/#{app_id}/#{run_id}"
|
102
|
+
file_path = "#{dir_path}/#{name}.json"
|
103
|
+
FileUtils.mkdir_p dir_path
|
104
|
+
JSONFilePersistedHash.new file_path
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
# @!endgroup
|
109
|
+
|
52
110
|
end
|
53
111
|
end
|
54
112
|
|