Skip to content

Commit

Permalink
Merge branch 'new-views' into dlsl
Browse files Browse the repository at this point in the history
* new-views:
  Minor typo fix
  fixed spec for Time encoding (microsecond issue)
  • Loading branch information
Oleg Andreev committed Apr 28, 2008
2 parents 74b442c + 56e88cc commit 8ff6a4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/strokedb/views/default_key_encoder.rb
Expand Up @@ -64,15 +64,15 @@ class ::Time
# slot.rb maintains timezone offset and keeps timezone-local time value
STROKEDB_KEY_CHAR = "T".freeze
def default_key_encode
STROKEDB_KEY_CHAR + getgm.xmlschema(6)
STROKEDB_KEY_CHAR + getgm.xmlschema(7)
end
end
end

class Document
AT_SIGN = "@".freeze
def default_key_encode
AT_SIGN + raw_uuid
AT_SIGN + uuid
end
end

Expand Down Expand Up @@ -126,7 +126,7 @@ def self.decode(string)
when X
token[R]
when T
Time.xmlschema(token[R])
Time.xmlschema(token[R]).localtime
else
token # unknown stuff is decoded as a string
end
Expand Down
2 changes: 1 addition & 1 deletion meta/papers/overview/views.txt
Expand Up @@ -108,7 +108,7 @@ Implementation note:



PERSISTANCE & UPDATES
PERSISTENCE & UPDATES

In theory, every view invocation must involve the whole dataspace processing.
In real world we need to optimize this by building persisted indexes
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/strokedb/views/default_key_encoder_spec.rb
Expand Up @@ -97,12 +97,12 @@
end.should raise_error(StandardError)
end

it "should encode Document and decode as a raw_uuid" do
it "should encode Document and decode as a uuid" do
setup_default_store
doc = Document.new
encoded_key = DefaultKeyEncoder.encode(doc)
encoded_key.should == "@#{doc.raw_uuid}"
DefaultKeyEncoder.decode(encoded_key).should == doc.raw_uuid
encoded_key.should == "@#{doc.uuid}"
DefaultKeyEncoder.decode(encoded_key).should == doc.uuid
end

it "should decode stuff without a known prefix as a string" do
Expand All @@ -125,7 +125,7 @@
strs.should == strs.sort

times2 = strs.map{|ts| DefaultKeyEncoder.decode(ts) }
times2.should == times
times2.zip(times) {|t2, t1| t2.should be_close(t1, 0.000002) }
end

end
Expand Down

0 comments on commit 8ff6a4c

Please sign in to comment.