Greetings, I’m new to Fauna and would love some advice with what I’m trying to do. This is to make sure I’m making a good decision while also furthering my understanding of the DB.
I have multiple processes writing to a versioned S3 bucket. I want to ensure unique object keys are generated.
My solution is to use Fauna to hold object key names and for writers to query fauna in order to 1) check if a key is unique and 2) reserve an object key by writing to a collection. Fauna’s global accessibility and strong consistency seem to be a good fit here. (Any suggestions to simplify solving the original problem are also valuable.)
My FaunaDB specific query is the following:
I see there are two ways to implement this.
a) Create an index to enforce uniqueness on a specific term in the collection’s documents.
b) Use the Create call on the collection with a generated key. This should fail if a document already exists with the given key.
My intuition is that b) would use less storage. I’m unsure what the actual trade offs are and how an experienced Fauna user would view this problem.
Thanks for the help!