Skip to content

Commit

Permalink
add breaking change documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Jun 10, 2024
1 parent 66735a5 commit ae40ad6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Support encryption for counters
We changed the data format of counters from int64 and float64 to bytes to support encryption. This changes the generated CIDs for counters.
14 changes: 7 additions & 7 deletions internal/core/crdt/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ func (c Counter) incrementValue(
return c.setPriority(ctx, c.key, priority)
}

func (c Counter) CType() client.CType {
if c.AllowDecrement {
return client.PN_COUNTER
}
return client.P_COUNTER
}

func validateAndIncrement[T Incrementable](
ctx context.Context,
store datastore.DSReaderWriter,
Expand All @@ -212,13 +219,6 @@ func validateAndIncrement[T Incrementable](
return cbor.Marshal(newValue)
}

func (c Counter) CType() client.CType {
if c.AllowDecrement {
return client.PN_COUNTER
}
return client.P_COUNTER
}

func getCurrentValue[T Incrementable](
ctx context.Context,
store datastore.DSReaderWriter,
Expand Down

0 comments on commit ae40ad6

Please sign in to comment.