Skip to content

Commit

Permalink
feat: Implement StateManipulator with cleaner, more efficient conflic…
Browse files Browse the repository at this point in the history
…t resolution
  • Loading branch information
stbrody committed Sep 11, 2023
1 parent 19d8f41 commit e340e38
Show file tree
Hide file tree
Showing 6 changed files with 905 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/conflict-resolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('pickLogToAccept', () => {
log: [{ cid: cids[4] }, { cid: cids[0], timestamp: 10 }],
} as unknown as StreamState

// When anchored in the same blockchain, same block, and with same log lengths, we should choose the one with
// When anchored in the same blockchain, same block, and with different log lengths, we should choose the one with
// longer log length
expect(await pickLogToAccept(state1, state2)).toEqual(state1)
expect(await pickLogToAccept(state2, state1)).toEqual(state1)
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/ceramic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,12 @@ export class Ceramic implements CeramicApi {
)
const tipFetcher = new TipFetcher(this.dispatcher.messageBus)
const logSyncer = new LogSyncer(this.dispatcher)
const stateManipulator = new StateManipulator()
const stateManipulator = new StateManipulator(
this._logger,
this._streamHandlers,
this.context,
logSyncer
)
const streamLoader = new StreamLoader(
this._logger,
tipFetcher,
Expand Down
Loading

0 comments on commit e340e38

Please sign in to comment.