Skip to content

Commit

Permalink
Change uint64 to int64 among data inserted into the DB (#381)
Browse files Browse the repository at this point in the history
According to the document below, when marshaling D or M to BSON, uint64
is marshaled to int64. So even now a number is less than math.MaxInt64
is fine, but changing it can make the datatype more consistent.

https://pkg.go.dev/go.mongodb.org/mongo-driver/bson#hdr-Native_Go_Types

Co-authored-by: Beomgi Kim <[email protected]>
  • Loading branch information
hackerwins and chromato99 authored Aug 5, 2022
1 parent 9a7bacb commit dd24c85
Show file tree
Hide file tree
Showing 33 changed files with 329 additions and 329 deletions.
4 changes: 2 additions & 2 deletions admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (c *Client) ListChangeSummaries(
ctx context.Context,
projectName string,
key key.Key,
previousSeq uint64,
previousSeq int64,
pageSize int32,
isForward bool,
) ([]*types.ChangeSummary, error) {
Expand All @@ -252,7 +252,7 @@ func (c *Client) ListChangeSummaries(
}

lastSeq := changes[len(changes)-1].ID().ServerSeq()
from, _ := types.GetChangesRange(types.Paging[uint64]{
from, _ := types.GetChangesRange(types.Paging[int64]{
Offset: previousSeq,
PageSize: int(pageSize),
IsForward: isForward,
Expand Down
122 changes: 61 additions & 61 deletions api/admin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions api/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ message GetDocumentResponse {
message GetSnapshotMetaRequest {
string project_name = 1;
string document_key = 2;
uint64 server_seq = 3 [jstype = JS_STRING];
int64 server_seq = 3 [jstype = JS_STRING];
}

message GetSnapshotMetaResponse {
bytes snapshot = 1;
uint64 lamport = 2 [jstype = JS_STRING];
int64 lamport = 2 [jstype = JS_STRING];
}

message SearchDocumentsRequest {
Expand All @@ -131,11 +131,11 @@ message SearchDocumentsResponse {
message ListChangesRequest {
string project_name = 1;
string document_key = 2;
uint64 previous_seq = 3 [jstype = JS_STRING];
int64 previous_seq = 3 [jstype = JS_STRING];
int32 page_size = 4;
bool is_forward = 5;
}

message ListChangesResponse {
repeated Change changes = 1;
}
}
Loading

0 comments on commit dd24c85

Please sign in to comment.