Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation(MAC)

Run EventStoreDB and PostgreSQL

docker-compose up -d 

Run Application

cargo run --bin web
  • Install sqlx-cli
cargo install sqlx-cli
  • To migrate, run below command
cargo sqlx migrate run --database-url postgres://frustacean:abc123@localhost:5434/community
  • After adding queries, run below command
cargo sqlx prepare --database-url postgres://frustacean:abc123@localhost:5434/community 

EventStoreDB Admin UI

Snapshoting

  • EventStoreDB doesn't support snapshotting.

How to implement snapshoting

  1. Events are appended to the stream post-123
  2. Every nth event, a snapshot is appended to the stream e.g. post_snapshot-123
    • use _ instead of - in the suffix _snapshot, - is used by the system projection
  3. Read backwards a single result from post_snapshot-123 stream
    ReadStreamOptions options = ReadStreamOptions.get()
        .backwards()
        .fromEnd();
    
    ReadResult result = client.readStream("post_snapshot-123", 1 /*maxCount*/, options)
        .get();
    
    List<ResolvedEvent> events = result.getEvents();
  4. Read forwards from nth revisino from post-123 stream
    ReadStreamOptions options = ReadStreamOptions.get()
        .forwards()
        .fromRevision(n);
    
    ReadResult result = client.readStream("post-123", options)
        .get();
    
    List<ResolvedEvent> events = result.getEvents();

Links

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages