mediachain / L-SPACE

[DEPRECATED] Books = Knowledge = Power = (Mass x Distance^2) / Time^3
MIT License
9 stars 1 forks source link

Merge API #68

Closed parkan closed 8 years ago

parkan commented 8 years ago

Reopening this to make merge simpler. Note that we may not actually need this inside L-SPACE; need to think about read/write separation.

Previous PR body (by @yusefnapora) below:

This adds a POST /merge/child-canonical-id/into/parent-canonical-id route. That seemed easier than requiring the client to POST a json body with the canonical ids, but I think we should probably go ahead and do that, since we'll also likely want to include some information about who's doing the merge and why (which we also need to figure out how to persist to the graph & query).

The diff is a bit noisy because I pulled out the withGraph helper and a new completeXor helper into SprayUtils and also flattened the route structure a bit by using e.g. (get & pathPrefix("/canonicals")) instead of nesting get and pathPrefix.

The completeXor directive will fail the request with a 500 status code on Xor.Left, or complete with the contents of the Xor.Right if successful.

The actual merge operation just looks up both canonicals and calls through to io.mediachain.Merge.mergeCanonicals.

parkan commented 8 years ago

Abandoning. Sorry to make you do all this work! 🙅

yusefnapora commented 8 years ago

lol, no problem :)