grpcdc/eventbus_git library
Git log serde for the event bus: exports an event log to a git branch (one commit per event) and imports it back. The live broker never touches git; this is the durable serde layer beside it. dart:io Process drives the git plumbing.
Deterministic: the same events always produce the same
commits, so re-exporting a log the branch already has is
a no-op (each event's sequence number is the dedup key).
The commit blob (event.pb) is authoritative; the message
subject and trailers are a human index for git log.
Constants
- eventLogBranch → const String
- gitAuthorEmail → const String
- gitAuthorName → const String
- gitBlobPath → const String
- gitCommitSubject → const String
- gitTrailerPublisher → const String
- gitTrailerSeq → const String
- gitTrailerTag → const String
- zeroSha → const String
Functions
-
branchHead(
String repo, String branch) → Future< String?> -
commitEnv(
Event event) → Map< String, String> -
commitMessage(
Event event) → String -
"grpc-dc event 42" plus Seq/Publisher/Tag trailers, so
git logalone can filter the log without decoding blobs. -
exportEvents(
String repo, List< Event> events, {String branch = eventLogBranch}) → Future<String?> - Export events onto the branch: one commit per event, in sequence order, skipping sequence numbers the branch already has. Returns the new head sha (or the existing one when nothing was appended). The ref update is a compare-and-swap: a concurrent exporter fails loudly instead of forking the log; retrying is safe.
-
gitBytes(
String repo, List< String> args, {List<int> ? inputBytes, Map<String, String> ? envExtra}) → Future<List< int> > -
gitText(
String repo, List< String> args, {List<int> ? inputBytes, Map<String, String> ? envExtra}) → Future<String> -
importEvents(
String repo, {String branch = eventLogBranch, int fromSeq = 0, int? toSeq, List< TagValue> ? filterTags}) → Future<List< Event> > - Import a branch: events in chain order (oldest first), optionally windowed by sequence number and narrowed by a tag filter (same containment semantics as Subscribe). A missing branch imports as an empty log.
-
initEventLogRepo(
String repo) → Future< void> -
Create the log repo if needed (a plain
git init).