Skip to content

Commit

Permalink
almost final touches to presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish R Jain committed Sep 27, 2015
1 parent d60385f commit f5c8ffa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion presentation/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func storeQuery() {
// Collect all Comment entities, and Likes on those comments.
p.Collect("Comment").Collect("Like")

// Alternatively, get everything up to certain depth.
// Alternatively, collect everything via breadth first iteration.
p = store.NewQuery("userid").UptoDepth(10)

result, _ := p.Run()
Expand Down
14 changes: 10 additions & 4 deletions presentation/gomeetup.slide
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ Because most startup founders have these concerns:
- Little thought spent on search engines to provide read-only access, or complex queries.
- Eager to sustain *technical*cancer* (/debt).

All these early decisions cause issues later on, as traffic starts growing.
It's hard to rewrite code or add abstraction layers later between code and database.

* How does Gocrud help?

- Keeps table schema stupid simple!
- Infinitely flexible data schema, thanks to Graph like operations.
- Data storage and representation is inherently horizontally scalable.
- Allows you to choose from a variety of data stores.
- Act as an abstraction layer above data store to keep application logic clear and separate.
- As things scale, swap out one data store with another, with no code changes.
- As things scale if data store becomes an issue, swap it out with another, with no code changes.
- Introduce search engines (like ElasticSearch) early on, to provide advanced search functionality, and avoid _abusing_ data stores.

* Design Principles
Expand All @@ -70,13 +73,15 @@ Added a deleted bit to all tables, to avoid deleting data.
* Implement Authorship
Keep a separate log table to store all the edits to the data.

.image logtable.jpg

* Representation in Gocrud
As you can see, the SQL / NoSQL table approach gets pretty complicated, pretty fast.

Instead, Gocrud uses *graph*approach*.

- Tables are considered entities, and all their properties and connections are edges.
- Edges are stored in an _append_only_ mode to data stores.
- Edges are inserted in _append_only_ mode in data stores.

.image social_graph.bmp

Expand All @@ -97,7 +102,8 @@ As Entities get modified in store, their corresponding search docs get re-genera

* So what's the exit Strategy?

- I hate frameworks!
- Every framework should have a way to be abandoned.
- I hate frameworks! Every framework should have a way to be abandoned.
- Create *store* and *search* modules, overwrite those functions with your custom implementation.

.code interface.go
# Show the functions here.
17 changes: 17 additions & 0 deletions presentation/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

type Update interface {
SetSource(source string) Update // Authorship
AddChild(kind string) Update // New entry in table kind
MarkDeleted() Update // Set deleted to true
Set(property string, value interface{}) Update
Execute() error
}

type Query interface {
UptoDepth(level int) Query
Collect(kind string) Query // select * from kind where parent = me;
FilterOut(property string) Query // where property is NULL;
Run() (Result, error)
}
type Result struct{}
Binary file added presentation/logtable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f5c8ffa

Please sign in to comment.