AtomEventsInFiles is one of AtomEventStore's built-in storage options. It uses the file system to store Atom Feed documents.
A single instance of AtomEventsInFiles can handle an arbitrary number of event streams; the size limit is determined by the file system itself.
Each event stream is identified with an ID (a GUID), so each event stream is persisted in a sub-directory named after that ID.
In each sub-directory is an index file, which has the same name as the sub-directory itself, and one or more Atom Feed page files. This makes file access times constant, because a client accessing a particular event stream already knows the ID of that event stream, which means that it already knows the name of the index file it needs to read.
An example directory structure might look like this:
Notice that the root directory can have any arbitrary name, but in this case it's simply called Root.
The first sub-directory is named 1c4d7d38-813c-403b-b531-7b2c95bd4cc2, which means that it corresponds to the event stream with the ID 1c4d7d38-813c-403b-b531-7b2c95bd4cc2. In that sub-directory you can see two files. One of the files has the same name as the directory (1c4d7d38-813c-403b-b531-7b2c95bd4cc2.xml); this is the index file of the event stream. It may look like this:
<feed xmlns="http://www.w3.org/2005/Atom"> <id>urn:uuid:1c4d7d38-813c-403b-b531-7b2c95bd4cc2</id> <title type="text">Index of event stream 1c4d7d38-813c-403b-b531-7b2c95bd4cc2</title> <updated>2014-04-24T10:31:23.1030710+02:00</updated> <author> <name>Grean</name> </author> <link rel="self" href="1c4d7d38-813c-403b-b531-7b2c95bd4cc2/1c4d7d38-813c-403b-b531-7b2c95bd4cc2"/> <link rel="first" href="1c4d7d38-813c-403b-b531-7b2c95bd4cc2/403f8322-f085-48b2-a6a0-16d4fcb054ac"/> <link rel="last" href="1c4d7d38-813c-403b-b531-7b2c95bd4cc2/403f8322-f085-48b2-a6a0-16d4fcb054ac"/> </feed>
Notice that in this example, the index points to the other file (403f8322-f085-48b2-a6a0-16d4fcb054ac.xml) as both the first and last page in the Atom Feed.
In one of the other sub-directories (bdb2d0f6-2b97-4795-9ce9-4080bd25cac2) you can see that there are multiple Atom Feed page files (three, to be exact) besides the index file (bdb2d0f6-2b97-4795-9ce9-4080bd25cac2.xml). This happens when there are more events in that particular event stream than fits in each page. The page size is a configurable value.
In order to use the AtomEventsInFiles
class, you must pass it a DirectoryInfo
value representing your root directory (Root in the above example):
var storage = new AtomEventsInFiles(directory);
Since AtomEventsInFiles
implements IAtomEventStorage, it can be passed to writers and readers of event streams.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4