From d2d08cecf4746a53df305fb67468919ef9657836 Mon Sep 17 00:00:00 2001 From: Emile Date: Thu, 7 Feb 2019 02:45:33 +0100 Subject: new model, see the wiki for a description how this all works --- README.md | 123 +++++++++++++++++--------------------------------------------- 1 file changed, 33 insertions(+), 90 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7e8b243..0e9eeca 100644 --- a/README.md +++ b/README.md @@ -18,96 +18,39 @@ This Repo contains the main "database" running an http-api exposing the quadtree | `"/export/{treeindex}"` | Export the selected tree to `db/{treeindex}.json` | | | `"/fastinsert/{filename}"` | Insert the selected file into a new tree | | - -## Files - -Simple description of each individual function - -### export.go - -``` -func export(treeindex int64) error { - // exports the tree with the given tree index by writing it's json - // to /exports/{treeindex}.json -} - -func exportHandler(w http.ResponseWriter, r *http.Request) { - // handles request to /export/{treeindex} and uses the export function - // to export the selected tree -} -``` - -### update.go - -``` -func updateCenterOfMassHandler(w http.ResponseWriter, r *http.Request) { - // updates the center of mass of every node in the tree width the given index -} - -func updateTotalMassHandler(w http.ResponseWriter, r *http.Request) { - // updates the total mass of every node in the tree with the given index -} -``` - -### import.go - +## Tables + +### nodes + +```postgresql +-- Table: public.nodes + +-- DROP TABLE public.nodes; + +CREATE TABLE public.nodes +( + node_id bigint NOT NULL DEFAULT nextval('nodes_node_id_seq'::regclass), + box_center_x numeric, + box_center_y numeric, + box_width numeric, + center_of_mass_x numeric, + center_of_mass_y numeric, + total_mass numeric, + depth numeric, + star_id bigint, + "subnode_A" bigint, + "subnode_B" bigint, + "subnode_C" bigint, + "subnode_D" bigint, + CONSTRAINT nodes_pkey PRIMARY KEY (node_id) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public.nodes + OWNER to postgres; ``` -func fastInsertHandler(w http.ResponseWriter, r *http.Request) { - // creates a new tree by reading from /db/{filename}.json and inserting the tree - // from that file into the treeArray - // The function returns the index in which it inserted the tree -} -``` - -### manage.go -``` -func newTreeHandler(w http.ResponseWriter, r *http.Request) { - // creates a new empty tree with the given width -} - -func newTree(width float64) []byte { - // creates a new tree and returns it json formatted as a bytestring -} - -func printAllHandler(w http.ResponseWriter, r *http.Request) { - // prints all the trees in the treeArray in json format -} - -func insertStarHandler(w http.ResponseWriter, r *http.Request) { - // inserts the given star into the tree -} - -func starlistHandler(w http.ResponseWriter, r *http.Request) { - // lists all the stars in the given tree -} - -func dumptreeHandler(w http.ResponseWriter, r *http.Request) { - // returns the tree with the given index in json format -} -``` - -### metrics.go - -``` -func metricHandler(w http.ResponseWriter, r *http.Request) { - // locally published the databases metrics -} - -func pushMetricsNumOfStars(host string, treeindex int64) { - // pushes the metrics of the tree with the given index to the metric-bundler - // using the given host and -} -``` - -### update.go - -``` -func updateCenterOfMassHandler(w http.ResponseWriter, r *http.Request) { - // updates the center of mass of every node in the tree with the given index -} -func updateTotalMassHandler(w http.ResponseWriter, r *http.Request) { - // updates the total mass in the tree with the given index -} -``` \ No newline at end of file -- cgit 1.4.1