Skip to content

Instantly share code, notes, and snippets.

@bmharper
Created August 6, 2019 13:41
Show Gist options
  • Save bmharper/4f29a071f89a194fd9046ebd58d3abc0 to your computer and use it in GitHub Desktop.
Save bmharper/4f29a071f89a194fd9046ebd58d3abc0 to your computer and use it in GitHub Desktop.
IMQS docstore 3rd try
3 Initialize Go project
8 DB design (DocMeta, DocBlob, Share, Link)
Migration
16 Use native Go/Mongo driver - SELECT ALL on everything except Blob
8 Test migrations on infraqa, imqsrc, demo
While migration is taking place, service must respond to ping.
Use regular migration system to ensure correctness.
APIs
2 GET Document Blob + tests (Fetch by ID)
1 PUT Document + tests
2 DELETE Document + tests
1 GET Document Hash + tests
2 GET Metadata + tests
1 FIND Documents, from DB, Table, Field (longlived ID search)
Share
2 CREATE Share + tests
1 GET + tests
1 DELETE + tests
DB Design
---------
Docs
id (bigserial)
blob (sha256)
path (varchar, slash separated for hierarchical tree: Water/Planbooks/abcd.pdf)
created_by
created_at
modified_by
modified_at
deleted_at
isalive (boolean default true)
contentType
blobSize
index (isalive, blob)
index (isalive, path)
FTS path WHERE isalive
Links
docid (int64) -- Docs.id
geometry
db (varchar)
table (varchar)
field (varchar)
value (varchar) -- field+value = longlived ID
[value can become outdated, and be healed via geometry]
legacyLat (double)
legacyLon (double)
Blob (in Postgres, but also hidden behind BlobStore interface)
(key:sha256 -> value:bytea)
Share
token (varchar)
docid (int64)
expires_at.. etc..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment