Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a Hybrid Logical Clock (HLC) implementation into the sg-bucket module (moved from Sync Gateway / Rosmar), including platform-specific wall-clock handling and accompanying unit tests.
Changes:
- Added
HybridLogicalClockimplementation for generating CAS-comparable HLC timestamps. - Added Windows-specific high-resolution wall clock implementation (via
GetSystemTimePreciseAsFileTime) with a non-Windows fallback. - Added unit tests covering monotonicity, masking, flooring behavior, reverse-time behavior, and concurrency safety; updated module dependencies to include
golang.org/x/sys.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hlc.go | Core HLC implementation and exported helpers/constants. |
| hlc_nonwindows.go | Non-Windows wall-clock source using time.Now().UnixNano(). |
| hlc_windows.go | Windows wall-clock source using high-resolution system time. |
| hlc_test.go | Test suite for HLC correctness and concurrency behavior. |
| go.mod | Adds golang.org/x/sys and bumps Go version directive. |
| go.sum | Adds checksums for the new golang.org/x/sys dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| module github.com/couchbase/sg-bucket | ||
|
|
||
| go 1.24.0 | ||
| go 1.25.0 |
Merged
RIT3shSapata
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This review was already done in an earlier stage of couchbase/sync_gateway#8375 - this just collapses the code into the sg-bucket repo from the sync_gateway and rosmar repos. This moves hlc files into sg-bucket from sync_gateway as they were done in the upstream sync gateway PR.
Blocks couchbaselabs/rosmar#79 and couchbase/sync_gateway#8375