tinkit 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/aws_sdb.log +31 -0
- data/examples/bufs_hello_world.rb +27 -0
- data/examples/example.rb +167 -0
- metadata +127 -5
@@ -0,0 +1,31 @@
|
|
1
|
+
# Logfile created on 2010-12-29 14:37:17 +0000 by logger.rb/25413
|
2
|
+
D, [2010-12-29T14:37:17.793199 #21256] DEBUG -- : CALL: get with {"Action"=>"ListDomains", "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:37:17Z"}
|
3
|
+
D, [2010-12-29T14:37:17.793351 #21256] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A17Z&Version=2009-04-15"
|
4
|
+
D, [2010-12-29T14:37:17.793607 #21256] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&Signature=3M1Dlhcu%2FurqpdVG62expTdGF4PGKxDW6HxU%2FeFmo4Y%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A17Z&Version=2009-04-15"
|
5
|
+
D, [2010-12-29T14:37:17.815592 #21256] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<ListDomainsResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ListDomainsResult><DomainName>MyDomain__SDBS3User005</DomainName><DomainName>forforf_test0</DomainName><DomainName>my-domain</DomainName><DomainName>my_domain</DomainName></ListDomainsResult><ResponseMetadata><RequestId>056fad82-8a7d-bfe9-075b-002c20b3852c</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>"
|
6
|
+
D, [2010-12-29T14:37:17.817785 #21256] DEBUG -- : DECODED DOC:
|
7
|
+
D, [2010-12-29T14:37:17.819009 #21256] DEBUG -- : CALL: post with {"Action"=>"CreateDomain", "DomainName"=>"MyDomain__Me", "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:37:17Z"}
|
8
|
+
D, [2010-12-29T14:37:17.819138 #21256] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=CreateDomain&DomainName=MyDomain__Me&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A17Z&Version=2009-04-15"
|
9
|
+
D, [2010-12-29T14:37:17.819382 #21256] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=CreateDomain&DomainName=MyDomain__Me&Signature=vpEf%2F3UAb64pqRehH3EB1dJjrr2gIZaBWFoHAZwepMk%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A17Z&Version=2009-04-15"
|
10
|
+
D, [2010-12-29T14:37:18.953256 #21256] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<CreateDomainResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ResponseMetadata><RequestId>0dad13c4-bb54-f437-5c23-63cb42907136</RequestId><BoxUsage>0.0055590278</BoxUsage></ResponseMetadata></CreateDomainResponse>"
|
11
|
+
D, [2010-12-29T14:37:18.955328 #21256] DEBUG -- : DECODED DOC:
|
12
|
+
D, [2010-12-29T14:37:19.254608 #21256] DEBUG -- : CALL: put with {"Action"=>"PutAttributes", "DomainName"=>"MyDomain__Me", "ItemName"=>"My_ID2", "Attribute.0.Name"=>"id", "Attribute.0.Value"=>"%22My_ID2%22", "Attribute.0.Replace"=>true, "Attribute.1.Name"=>"data", "Attribute.1.Value"=>"%22Hello%20World%20from%20AWS%20Simple%20DB%20%28with%20S3%20for%20files%29%22", "Attribute.1.Replace"=>true, "Attribute.2.Name"=>"_id", "Attribute.2.Value"=>"%22MyDomain__Me%3A%3AMy_ID2%22", "Attribute.2.Replace"=>true, "Attribute.3.Name"=>"sdbs3_namespace", "Attribute.3.Value"=>"%22MyDomain__Me%22", "Attribute.3.Replace"=>true, "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:37:19Z"}
|
13
|
+
D, [2010-12-29T14:37:19.254958 #21256] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=PutAttributes&Attribute.0.Name=id&Attribute.0.Replace=true&Attribute.0.Value=%2522My_ID2%2522&Attribute.1.Name=data&Attribute.1.Replace=true&Attribute.1.Value=%2522Hello%2520World%2520from%2520AWS%2520Simple%2520DB%2520%2528with%2520S3%2520for%2520files%2529%2522&Attribute.2.Name=_id&Attribute.2.Replace=true&Attribute.2.Value=%2522MyDomain__Me%253A%253AMy_ID2%2522&Attribute.3.Name=sdbs3_namespace&Attribute.3.Replace=true&Attribute.3.Value=%2522MyDomain__Me%2522&DomainName=MyDomain__Me&ItemName=My_ID2&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A19Z&Version=2009-04-15"
|
14
|
+
D, [2010-12-29T14:37:19.255354 #21256] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=PutAttributes&Attribute.0.Name=id&Attribute.0.Replace=true&Attribute.0.Value=%2522My_ID2%2522&Attribute.1.Name=data&Attribute.1.Replace=true&Attribute.1.Value=%2522Hello%2520World%2520from%2520AWS%2520Simple%2520DB%2520%2528with%2520S3%2520for%2520files%2529%2522&Attribute.2.Name=_id&Attribute.2.Replace=true&Attribute.2.Value=%2522MyDomain__Me%253A%253AMy_ID2%2522&Attribute.3.Name=sdbs3_namespace&Attribute.3.Replace=true&Attribute.3.Value=%2522MyDomain__Me%2522&DomainName=MyDomain__Me&ItemName=My_ID2&Signature=0fUhCYEwYahFbhHMgzxajXydEvoqEB9ZJCd5JQiAi2k%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A37%3A19Z&Version=2009-04-15"
|
15
|
+
D, [2010-12-29T14:37:19.344605 #21256] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<PutAttributesResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ResponseMetadata><RequestId>163bf8b3-7451-50be-db0c-5fe303cadab2</RequestId><BoxUsage>0.0000220035</BoxUsage></ResponseMetadata></PutAttributesResponse>"
|
16
|
+
D, [2010-12-29T14:37:19.346345 #21256] DEBUG -- : DECODED DOC:
|
17
|
+
D, [2010-12-29T14:52:15.514130 #21259] DEBUG -- : CALL: get with {"Action"=>"ListDomains", "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:52:15Z"}
|
18
|
+
D, [2010-12-29T14:52:15.514311 #21259] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A15Z&Version=2009-04-15"
|
19
|
+
D, [2010-12-29T14:52:15.514564 #21259] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&Signature=Hhs1x8T52hpqmofqa9u3RE7lmP59p8pPIJKYJuObr0A%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A15Z&Version=2009-04-15"
|
20
|
+
D, [2010-12-29T14:52:15.537625 #21259] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<ListDomainsResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ListDomainsResult><DomainName>MyDomain__Me</DomainName><DomainName>MyDomain__SDBS3User005</DomainName><DomainName>forforf_test0</DomainName><DomainName>my-domain</DomainName><DomainName>my_domain</DomainName></ListDomainsResult><ResponseMetadata><RequestId>397cca52-10ff-53e1-dd22-d7f6337db353</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>"
|
21
|
+
D, [2010-12-29T14:52:15.539787 #21259] DEBUG -- : DECODED DOC:
|
22
|
+
D, [2010-12-29T14:52:34.326683 #21261] DEBUG -- : CALL: get with {"Action"=>"ListDomains", "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:52:34Z"}
|
23
|
+
D, [2010-12-29T14:52:34.326876 #21261] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A34Z&Version=2009-04-15"
|
24
|
+
D, [2010-12-29T14:52:34.327127 #21261] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=ListDomains&Signature=1KxgSw57RFGTI2uiKjVc9KLYcoOr1npwiLIGwP2VIwo%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A34Z&Version=2009-04-15"
|
25
|
+
D, [2010-12-29T14:52:34.354194 #21261] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<ListDomainsResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ListDomainsResult><DomainName>MyDomain__Me</DomainName><DomainName>MyDomain__SDBS3User005</DomainName><DomainName>forforf_test0</DomainName><DomainName>my-domain</DomainName><DomainName>my_domain</DomainName></ListDomainsResult><ResponseMetadata><RequestId>58b5e8fd-13fe-598d-3505-dc4def7f10f4</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>"
|
26
|
+
D, [2010-12-29T14:52:34.356328 #21261] DEBUG -- : DECODED DOC:
|
27
|
+
D, [2010-12-29T14:52:34.452464 #21261] DEBUG -- : CALL: put with {"Action"=>"PutAttributes", "DomainName"=>"MyDomain__Me", "ItemName"=>"My_ID2", "Attribute.0.Name"=>"id", "Attribute.0.Value"=>"%22My_ID2%22", "Attribute.0.Replace"=>true, "Attribute.1.Name"=>"data", "Attribute.1.Value"=>"%22Hello%20World%20from%20AWS%20Simple%20DB%20%28with%20S3%20for%20files%29%22", "Attribute.1.Replace"=>true, "Attribute.2.Name"=>"_id", "Attribute.2.Value"=>"%22MyDomain__Me%3A%3AMy_ID2%22", "Attribute.2.Replace"=>true, "Attribute.3.Name"=>"sdbs3_namespace", "Attribute.3.Value"=>"%22MyDomain__Me%22", "Attribute.3.Replace"=>true, "Attribute.4.Name"=>"_rev", "Attribute.4.Value"=>"924295311", "Attribute.4.Replace"=>true, "Version"=>"2009-04-15", "SignatureMethod"=>"HmacSHA256", "SignatureVersion"=>"2", "AWSAccessKeyId"=>"AKIAJZT2KIZFM36DNBVQ", "Timestamp"=>"2010-12-29T14:52:34Z"}
|
28
|
+
D, [2010-12-29T14:52:34.452888 #21261] DEBUG -- : CANONICAL: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=PutAttributes&Attribute.0.Name=id&Attribute.0.Replace=true&Attribute.0.Value=%2522My_ID2%2522&Attribute.1.Name=data&Attribute.1.Replace=true&Attribute.1.Value=%2522Hello%2520World%2520from%2520AWS%2520Simple%2520DB%2520%2528with%2520S3%2520for%2520files%2529%2522&Attribute.2.Name=_id&Attribute.2.Replace=true&Attribute.2.Value=%2522MyDomain__Me%253A%253AMy_ID2%2522&Attribute.3.Name=sdbs3_namespace&Attribute.3.Replace=true&Attribute.3.Value=%2522MyDomain__Me%2522&Attribute.4.Name=_rev&Attribute.4.Replace=true&Attribute.4.Value=924295311&DomainName=MyDomain__Me&ItemName=My_ID2&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A34Z&Version=2009-04-15"
|
29
|
+
D, [2010-12-29T14:52:34.453340 #21261] DEBUG -- : ACTUALQUERY: "AWSAccessKeyId=AKIAJZT2KIZFM36DNBVQ&Action=PutAttributes&Attribute.0.Name=id&Attribute.0.Replace=true&Attribute.0.Value=%2522My_ID2%2522&Attribute.1.Name=data&Attribute.1.Replace=true&Attribute.1.Value=%2522Hello%2520World%2520from%2520AWS%2520Simple%2520DB%2520%2528with%2520S3%2520for%2520files%2529%2522&Attribute.2.Name=_id&Attribute.2.Replace=true&Attribute.2.Value=%2522MyDomain__Me%253A%253AMy_ID2%2522&Attribute.3.Name=sdbs3_namespace&Attribute.3.Replace=true&Attribute.3.Value=%2522MyDomain__Me%2522&Attribute.4.Name=_rev&Attribute.4.Replace=true&Attribute.4.Value=924295311&DomainName=MyDomain__Me&ItemName=My_ID2&Signature=iZFfPy1x%2FHTPaAo2gOiHZqt76P2zyp0L7Kme3vwQcLY%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2010-12-29T14%3A52%3A34Z&Version=2009-04-15"
|
30
|
+
D, [2010-12-29T14:52:34.524490 #21261] DEBUG -- : RESP: "<?xml version=\"1.0\"?>\n<PutAttributesResponse xmlns=\"http://sdb.amazonaws.com/doc/2009-04-15/\"><ResponseMetadata><RequestId>8284a9f8-a0c5-f38d-798c-97c879a7c5c3</RequestId><BoxUsage>0.0000220157</BoxUsage></ResponseMetadata></PutAttributesResponse>"
|
31
|
+
D, [2010-12-29T14:52:34.526196 #21261] DEBUG -- : DECODED DOC:
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require '../lib/bufs' #<-- to be replaced by gem
|
2
|
+
|
3
|
+
# First we need to describe the environment for bufs
|
4
|
+
# we will use the file system as our persistend stoe and
|
5
|
+
# the default data model to simplify things a bit.
|
6
|
+
env = {:node_class_id => "HelloWorldClass",
|
7
|
+
:persist_model => {
|
8
|
+
:name => "filesystem",
|
9
|
+
:key_fields => {
|
10
|
+
:required_keys => [:id],
|
11
|
+
:primary_key => :id,
|
12
|
+
},
|
13
|
+
:env => {
|
14
|
+
:user_id => "me",
|
15
|
+
:path => "/tmp/bufs_hello_world_test/"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
MyNodeClass = TinkitNodeFactory.make(env)
|
21
|
+
hello_world_node = MyNodeClass.new( {:id => 'hw_id', :data => "Hello World"} )
|
22
|
+
|
23
|
+
#to see your node's data, just call the fields as a method call
|
24
|
+
p hello_world_node.id
|
25
|
+
p hello_world_node.data
|
26
|
+
#to save your node to the data store
|
27
|
+
hello_world_node.__save
|
data/examples/example.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
require '../lib/bufs' #<-- eventually will be gem 'bufs'
|
2
|
+
#require '../lib/moabs/moab_couchrest_env'
|
3
|
+
#equire '../lib/glue_envs/bufs_couchrest_glue_env'
|
4
|
+
#require '../lib/midas/node_element_operations'
|
5
|
+
|
6
|
+
#We need to define the datastructure we'll be starting with. We can change it dynamically as well,
|
7
|
+
#but it is usually helpful to have a defined base to start from
|
8
|
+
|
9
|
+
#TODO: Make the appropriate helpers to assist in this
|
10
|
+
#TODO: define_method might work better, or maybe even just def
|
11
|
+
|
12
|
+
#What does this do and why is it needed?
|
13
|
+
#I wanted something that:
|
14
|
+
# - would have Class like methods for collections ala Rails
|
15
|
+
# - have the persistence layer be defined dynamically during run-time
|
16
|
+
# - be portable across multiple persistence layers
|
17
|
+
# -corollary: portability can be dynamic as well (#though not implemented yet)
|
18
|
+
# - support multiple users
|
19
|
+
# - support customized operations on its data structures
|
20
|
+
#None of the existing frameworks that I knew of did all of these, so that led to this one
|
21
|
+
|
22
|
+
#Thinking about things slightly different
|
23
|
+
#Define a data structure independent of any underlying model
|
24
|
+
|
25
|
+
#TODO: Move these into the main libs.
|
26
|
+
#Currently spec helpers, but should be part of main lib
|
27
|
+
#and then removed from specs as helpers, but add specs
|
28
|
+
#to test them
|
29
|
+
module NodeHelper
|
30
|
+
def self.env_builder(model_name, node_class_id, user_id, path, host = nil)
|
31
|
+
#binding data (note this occurs in two different places in the env)
|
32
|
+
|
33
|
+
key_fields = {:required_keys => [:id],
|
34
|
+
:primary_key => :id }
|
35
|
+
|
36
|
+
|
37
|
+
#data model
|
38
|
+
field_op_set =nil
|
39
|
+
#op_set_mod => <Using default definitions>
|
40
|
+
|
41
|
+
data_model = {:field_op_set => field_op_set, :key_fields => key_fields, :views => nil}
|
42
|
+
|
43
|
+
#persistence layer model
|
44
|
+
pmodel_env = { :host => host,
|
45
|
+
:path => path,
|
46
|
+
:user_id => user_id}
|
47
|
+
persist_model = {:name => model_name, :env => pmodel_env}
|
48
|
+
|
49
|
+
#final env model
|
50
|
+
env = { :node_class_id => node_class_id,
|
51
|
+
:data_model => data_model,
|
52
|
+
:persist_model => persist_model }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
#If you have CouchRest:
|
58
|
+
#Lets create a couchrest instance to interface to our CouchDB
|
59
|
+
require 'couchrest'
|
60
|
+
example_couchdb_location = "http://127.0.0.1:5984/example/"
|
61
|
+
#example_couchdb_location = "http://bufs.couchone.com/example"
|
62
|
+
couchrest_instance = CouchRest.database!(example_couchdb_location)
|
63
|
+
|
64
|
+
#while we're at it, lets create a filesystem store as well
|
65
|
+
filestore_loc = "/tmp/bufs_test/"
|
66
|
+
|
67
|
+
couch_class_id = :CouchClass
|
68
|
+
file_class_id = :FileClass
|
69
|
+
sdbs3_class_id = :SdbS3Class
|
70
|
+
user_id = "Me"
|
71
|
+
|
72
|
+
cr_path = couchrest_instance.uri
|
73
|
+
cr_host = couchrest_instance.host
|
74
|
+
|
75
|
+
fs_path = filestore_loc
|
76
|
+
|
77
|
+
sdbs3_path = "MyDomain"
|
78
|
+
#filesystem doesn't require host
|
79
|
+
#building the couchrest environment
|
80
|
+
couch_env = NodeHelper.env_builder("bufs_couchrest", couch_class_id, user_id, cr_path, cr_host)
|
81
|
+
|
82
|
+
#building the filesystem environment
|
83
|
+
filesys_env = NodeHelper.env_builder("bufs_filesystem", file_class_id, user_id, fs_path)
|
84
|
+
#p couch_env
|
85
|
+
|
86
|
+
#building an environment for AWS (Simple DB for data, S3 for attachments)
|
87
|
+
sdbs3_env = NodeHelper.env_builder("sdb_s3", sdbs3_class_id, user_id, sdbs3_path)
|
88
|
+
|
89
|
+
#Testing with Class for NodeElementOperations
|
90
|
+
#node_ops = NewNodeElementOperations.new.data_ops
|
91
|
+
|
92
|
+
#In the future you won't need seperate classes for the models.
|
93
|
+
|
94
|
+
ExampleCouchClass = TinkitNodeFactory.make(couch_env)
|
95
|
+
ExampleFileClass = TinkitNodeFactory.make(filesys_env)
|
96
|
+
ExampleSdbS3Class = TinkitNodeFactory.make(sdbs3_env)
|
97
|
+
a_couch_node = ExampleCouchClass.new({:id => "My_ID1", :data => "Hello World from couchrest"})
|
98
|
+
|
99
|
+
|
100
|
+
a_file_node = ExampleFileClass.new({:id => "My_ID2", :data =>"Hello World from filesystem" })
|
101
|
+
|
102
|
+
a_sdbs3_node = ExampleSdbS3Class.new({:id => "My_ID2", :data =>"Hello World from AWS Simple DB (with S3 for files)" })
|
103
|
+
puts "Nodes in memory"
|
104
|
+
p a_couch_node._user_data
|
105
|
+
p a_file_node._user_data
|
106
|
+
p a_sdbs3_node._user_data
|
107
|
+
|
108
|
+
a_couch_node.__save
|
109
|
+
a_file_node.__save
|
110
|
+
a_sdbs3_node.__save
|
111
|
+
|
112
|
+
puts "Node in CouchDB"
|
113
|
+
#p hello_world_node
|
114
|
+
p couchrest_instance.get(a_couch_node._model_metadata[:_id])
|
115
|
+
puts
|
116
|
+
puts "Or you can get the couch node from the command line using curl:"
|
117
|
+
puts "curl -X GET #{example_couchdb_location}/#{CGI.escape(a_couch_node._model_metadata[:_id])}"
|
118
|
+
puts
|
119
|
+
puts "The file data should be at (look for .node_data.json)"
|
120
|
+
puts "ls -al #{File.join(a_file_node._model_metadata[:files_namespace], a_file_node._user_data[:id])}/"
|
121
|
+
puts "We can also add a field dynamically, for example a \"tags\" field"
|
122
|
+
puts "Node after dynamically adding new data element"
|
123
|
+
puts
|
124
|
+
|
125
|
+
#after this hello_world node is the same as a couch node
|
126
|
+
hello_world_node = a_couch_node
|
127
|
+
hello_world_node.__set_userdata_key(:tags, ["tag1", "tag2"])
|
128
|
+
p hello_world_node._user_data
|
129
|
+
puts "You don't have to add a field defined in the element operations"
|
130
|
+
puts "the \"random_field\" will behave (how? what is the default behavior?"
|
131
|
+
#TODO, if no value provided, default to nil (no reason to force user to set it)
|
132
|
+
#TODO: Raise an appropriate error if an operation tag is left off (add, subtract, etc)
|
133
|
+
#TODO: Provide a default operation set for unspecified tags
|
134
|
+
#TODO: Also allow user to set the default operation to use for undefined tags
|
135
|
+
hello_world_node.__set_userdata_key(:random_field, nil)
|
136
|
+
#p hello_world_node._user_data
|
137
|
+
puts
|
138
|
+
puts "Node Element Operations in action"
|
139
|
+
puts "Lets Add \"WontAdd\" to the :id field"
|
140
|
+
puts "and \"A New Hello World\" to the :data field"
|
141
|
+
puts "and \"tag3\" to the tags field"
|
142
|
+
hello_world_node.id_add "WontAdd"
|
143
|
+
#p hello_world_node
|
144
|
+
hello_world_node.data_add "A New Hello World"
|
145
|
+
hello_world_node.tags_add "tag3"
|
146
|
+
|
147
|
+
#this was testing wrong op names
|
148
|
+
#p hello_world_node.tags_blue "taggity tag"
|
149
|
+
#p hello_world_node.tagssss
|
150
|
+
|
151
|
+
#"We can't add \"random\" to the random_field field until we define the operation"
|
152
|
+
#Is this fixed yet?
|
153
|
+
random_op = {:random_field => :replace_ops}
|
154
|
+
|
155
|
+
#p hello_world_node.class.data_struc
|
156
|
+
hello_world_node.class.data_struc.set_op(random_op)
|
157
|
+
hello_world_node.__set_userdata_key(:random_field, nil)
|
158
|
+
#p hello_world_node.class.data_struc
|
159
|
+
hello_world_node.random_field_add "random"
|
160
|
+
p hello_world_node._user_data
|
161
|
+
|
162
|
+
puts "Calling views (filtering records)"
|
163
|
+
p hello_world_node.class.call_new_view(:id, "My_ID1")
|
164
|
+
p a_file_node.class.call_new_view(:data, "Hello World from filesystem")
|
165
|
+
|
166
|
+
|
167
|
+
puts "Ok, now lets subtract (later)"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dave Martin
|
@@ -16,9 +16,128 @@ cert_chain: []
|
|
16
16
|
|
17
17
|
date: 2011-01-14 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
21
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: log4r
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 1
|
31
|
+
- 9
|
32
|
+
version: 1.1.9
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: mime-types
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - "="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 6
|
46
|
+
- 2
|
47
|
+
version: 1.6.2
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: hpricot
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - "="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
- 8
|
61
|
+
- 2
|
62
|
+
version: 0.8.2
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: couchrest
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - "="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
- 3
|
76
|
+
- 5
|
77
|
+
version: 0.3.5
|
78
|
+
type: :runtime
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rest-client
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - "="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 2
|
91
|
+
- 0
|
92
|
+
version: 1.2.0
|
93
|
+
type: :runtime
|
94
|
+
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: forforf-aws-sdb
|
97
|
+
prerelease: false
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
- 5
|
106
|
+
- 1
|
107
|
+
version: 0.5.1
|
108
|
+
type: :runtime
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: dbi
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - "="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
- 4
|
121
|
+
- 5
|
122
|
+
version: 0.4.5
|
123
|
+
type: :runtime
|
124
|
+
version_requirements: *id007
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: dbd-mysql
|
127
|
+
prerelease: false
|
128
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - "="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
- 4
|
136
|
+
- 4
|
137
|
+
version: 0.4.4
|
138
|
+
type: :runtime
|
139
|
+
version_requirements: *id008
|
140
|
+
description: Tinkit, a portable persistence layer for cloud, disk, and others
|
22
141
|
email: dmarti21@gmail.com
|
23
142
|
executables: []
|
24
143
|
|
@@ -78,6 +197,9 @@ files:
|
|
78
197
|
- spec/tinkit_node_factory_spec.rb
|
79
198
|
- spec/node_element_operations_spec.rb
|
80
199
|
- spec/filesystem_helpers_spec.rb
|
200
|
+
- examples/bufs_hello_world.rb
|
201
|
+
- examples/example.rb
|
202
|
+
- examples/aws_sdb.log
|
81
203
|
has_rdoc: true
|
82
204
|
homepage: http://github.com/forforf/tinkit
|
83
205
|
licenses: []
|