Horseman, for all intents and purposes, is a internet-accessible database, we've just constructed a Content-Management-System (CMS) on top of it to make it easy to use. Internally, it does all of the things you'd expect a normal database to do, but it does it everywhere around the world. All without colliding or having concurrency issues.
Whats a Headless CMS?
A headless CMS is a Content-Management-System that doesnt have a frontend of its own. Unlike Wordpress, Horseman only provides data storage and sorting, you need to provide the website. But dont fret, we have plenty of examples for you to draw from!
How does Horseman store data?
Horseman stores data using Cloudflare's KV™ product, a key-value store that lives at the edge. However, you may notice KV is only a key-value store, it has no searching or filtering systems. Thats the magic of Horseman. It creates all of the nessessary things you'd need if you wanted to run a database at the edge.
What is "indexing"
An index is simply the glossary at the end of a book, helping guide you to the page you want to find. When you create, update, or delete any Object, we update the index to ensure your data is findable in the future. For example, if you set the field "Title" to be indexable, when you add a new Object, we take your new "Title", append it to the end of your pre-existing "Title" index. Then when you search your Objects by "Title", we just open up this giant array and find all the matching Titles. See below for an example index:
[
[ "Hello, World", "<ObjectID>" ],
[ "Blog Title 1", "<ObjectID2>" ]
]
How does Horseman deal with concurrent updates?
When you change your Objects, we send off a request to a "Durable Object". This is another feature by Cloudflare that allows you to run code that is guaranteed to be the only in the world. This "Index Writer" takes the new information, amends the index, and commits the changes to KV, ensuring your data is always up to date without collisions and concurrency mistakes.