dwyl / dwyl/phoenix-ecto-append-only-log-example

Questions/thoughts on ALOG style functions using CID

Open
#23 2 comments 0 reactions 3 assignees Claimed by @Danwhy View on GitHub
discuss question
Dominant language
Elixir
Stars
82
Forks
5
PR merge metrics
No merged PRs in 30d

Description

relates to #22

## Insert
From what I can tell `insert` would remain largely unchanged. We would just swap inserting the UUID for a CID we make.

Please add thoughts on this if I have overlooked anything

## Get
#### How do we want to handle someone calling `get` with an old/previous CID?
Do we want to...
- give a user the old version of the data?
- give the user the latest version of the data?
- how do we want to access that data? Imagine the table below but with the same field edited 100 times. With the current fields in the table, if we were to try and serve the user the most recent version we would have to make about 100 `get` calls, where each one would return the 'next iteration' until the end of the line.
- Do we keep the UUID as well as add the CID. This way we could still link all entries together and get the most recent version in one call? If we keep the UUID would this make the `prev` column redundant (as we would be able to tell the previous version from timestamps)
- give the user an error and have a separate function called `get_previous` (name tbd) that will handle returning old data?

## Update
#### How do we want to handle someone calling the `update` function with an old/previous CID?
- do we update the most recent version? (same point as get when it comes to retrieving the old data)
- do we update the old version (I guess this would be similar to branching off)




| `inserted ` | **`cid`**(PK)1 | **`name`** | **`address`** | **`prev`** |
| ----------- | ------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| 1541609554 | **gVSTedHFGBetxy** | Bruce Wane | 1007 Mountain Drive, Gotham | null |
| 1541618643 | smnELuCmEaX42 | Bruce Wane | [Rua Goncalo Afonso, Vila Madalena, Sao Paulo, 05436-100, Brazil](https://www.tripadvisor.co.uk/ShowUserReviews-g303631-d2349935-r341872180-Batman_Alley-Sao_Paulo_State_of_Sao_Paulo.html "Batman Alley ;-)") | **gVSTedHFGBetxy** |

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.