shameless 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/CHANGELOG.md +4 -1
- data/README.md +2 -0
- data/lib/shameless/cell.rb +9 -4
- data/lib/shameless/model.rb +6 -2
- data/lib/shameless/store.rb +1 -1
- data/lib/shameless/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 839607ae8ec8ee9e759f37a6f2a6c69264fca086
|
4
|
+
data.tar.gz: 498b1d442dc13719c2a67a5a3176f0bf160baa32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2f01520df26451f4b64fa4b70bcbe24d169565d105955a715f88245680e032b8aa8065f8c03354440a07e6e7d385473ad7e45f30e5017529b266a2cea1d5579
|
7
|
+
data.tar.gz: 06d827ed97efc129c88ec1d0ded8f0d271a990b84580129b436957f38e5ed3638f2d6761551670afd292ac9fb5c2d3dc217f97dcd3800513dfdc0b625391183e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Shameless
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/hoteltonight/shameless.svg?branch=master)](https://travis-ci.org/hoteltonight/shameless)
|
4
|
+
|
3
5
|
Shameless is an implementation of a schemaless, distributed, append-only store built on top of MySQL and the Sequel gem. It was extracted from a battle-tested codebase of our main application at HotelTonight. Since it's using Sequel for database access, it could work on any database, e.g. postgres, although we've only used it with MySQL.
|
4
6
|
|
5
7
|
## Background
|
data/lib/shameless/cell.rb
CHANGED
@@ -18,6 +18,7 @@ module Shameless
|
|
18
18
|
def initialize(model, name, values = nil)
|
19
19
|
@model = model
|
20
20
|
@name = name
|
21
|
+
reload
|
21
22
|
initialize_from_values(values)
|
22
23
|
end
|
23
24
|
|
@@ -36,7 +37,7 @@ module Shameless
|
|
36
37
|
@created_at = (@created_at.to_f * 1000).to_i if @model.class.store.configuration.legacy_created_at_is_bigint
|
37
38
|
@ref_key ||= -1
|
38
39
|
@ref_key += 1
|
39
|
-
@model.put_cell(cell_values)
|
40
|
+
@id = @model.put_cell(cell_values(true))
|
40
41
|
end
|
41
42
|
|
42
43
|
def update(values)
|
@@ -69,7 +70,7 @@ module Shameless
|
|
69
70
|
end
|
70
71
|
|
71
72
|
def reload
|
72
|
-
@body = @ref_key = @created_at = nil
|
73
|
+
@id = @body = @ref_key = @created_at = nil
|
73
74
|
end
|
74
75
|
|
75
76
|
def fetch(key, default)
|
@@ -85,15 +86,19 @@ module Shameless
|
|
85
86
|
@model.uuid
|
86
87
|
end
|
87
88
|
|
89
|
+
def as_json(*)
|
90
|
+
cell_values(false).merge(id: id)
|
91
|
+
end
|
92
|
+
|
88
93
|
private
|
89
94
|
|
90
|
-
def cell_values
|
95
|
+
def cell_values(serialize_body)
|
91
96
|
{
|
92
97
|
uuid: uuid,
|
93
98
|
column_name: @name,
|
94
99
|
ref_key: ref_key,
|
95
100
|
created_at: created_at,
|
96
|
-
body: serialized_body
|
101
|
+
body: serialize_body ? serialized_body : body
|
97
102
|
}
|
98
103
|
end
|
99
104
|
|
data/lib/shameless/model.rb
CHANGED
@@ -36,8 +36,8 @@ module Shameless
|
|
36
36
|
else
|
37
37
|
uuid = SecureRandom.uuid
|
38
38
|
|
39
|
-
new(uuid, values).tap do |
|
40
|
-
|
39
|
+
new(uuid, values).tap do |m|
|
40
|
+
m.save
|
41
41
|
|
42
42
|
index_values = values.merge(uuid: uuid)
|
43
43
|
@indices.each {|i| i.put(index_values) }
|
@@ -152,6 +152,10 @@ module Shameless
|
|
152
152
|
base.present?
|
153
153
|
end
|
154
154
|
|
155
|
+
def as_json(*)
|
156
|
+
base.as_json
|
157
|
+
end
|
158
|
+
|
155
159
|
def reload
|
156
160
|
cells.each(&:reload)
|
157
161
|
end
|
data/lib/shameless/store.rb
CHANGED
data/lib/shameless/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shameless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olek Janiszewski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.5.
|
143
|
+
rubygems_version: 2.5.2
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Scalable distributed append-only data store
|