Skip to content

Commit

Permalink
Add documentation section about the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
albe committed May 31, 2020
1 parent 89ab1d9 commit aae2c6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ Note: If there are any misconceptions on my side to the ACID semantics, let me k

Currently, the `storage` guarantees a consistent global ordering on all events by managing a global primary index. This makes
sure that streams that are made up of multiple write-streams will stay consistent when re-reading all events. This has some
issues though, like not being able to consistently reindex a storage, which is discussed in https://github.com/albe/node-event-storage/issues/24. Therefore, this guarantee may be relaxed in later versions.
issues though, like not being able to consistently reindex a storage, which is discussed in https://github.com/albe/node-event-storage/issues/24.

Since version 0.8 the storage also stores a monotonic clock stamp and an external sequence number together with the document.
This way, a consistent global order can also be reconsituted without a global index. In a later version, the global index might
therefore be removed and reindexing a storage be possible, which allows to rebuild a consistent state after a destructive crash.

### Event Streams

Expand Down
3 changes: 2 additions & 1 deletion src/Partition/WritablePartition.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ class WritablePartition extends ReadablePartition {
const dataHeader = Buffer.alloc(DOCUMENT_HEADER_SIZE);
this.writeDocumentHeader(dataHeader, 0, dataSize, sequenceNumber);

let bytesWritten = fs.writeSync(this.fd, dataHeader);
let bytesWritten = 0;
bytesWritten += fs.writeSync(this.fd, dataHeader);
bytesWritten += fs.writeSync(this.fd, data);
if (typeof callback === 'function') {
process.nextTick(callback);
Expand Down

0 comments on commit aae2c6a

Please sign in to comment.