Skip to content

Commit

Permalink
Rename GetId to GetID
Browse files Browse the repository at this point in the history
This is a breaking change, but the package is in alpha.

The idea is to respect Go initialisms.

https://google.github.io/styleguide/go/decisions.html#initialisms
  • Loading branch information
ccoVeille committed Nov 11, 2024
1 parent 5b3f79f commit 00afae1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func NewStructure(config *config.FairnessTrackerConfig, id uint64, includeStats
return NewStructureWithClock(config, id, includeStats, utils.NewRealClock())
}

func (s *Structure) GetId() uint64 {
func (s *Structure) GetID() uint64 {
return s.id
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/data/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestHashes(t *testing.T) {
assert.Equal(t, hashes[2], hashes2[2])
}

func TestGetId(t *testing.T) {
func TestGetID(t *testing.T) {
conf := &config.FairnessTrackerConfig{
L: 2,
M: 24,
Expand All @@ -116,7 +116,7 @@ func TestGetId(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, structure)

assert.Equal(t, int(structure.GetId()), 1)
assert.Equal(t, int(structure.GetID()), 1)
}

func TestEndToEnd(t *testing.T) {
Expand All @@ -132,7 +132,7 @@ func TestEndToEnd(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, structure)

assert.Equal(t, int(structure.GetId()), 1)
assert.Equal(t, int(structure.GetID()), 1)

ctx := context.Background()
id := []byte("hello_world")
Expand Down
2 changes: 1 addition & 1 deletion pkg/request/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type ReportOutcomeResult struct{}
// The data struecture interface
type Tracker interface {
// Return the int ID of this structure. Used for implementing moving hashes.
GetId() uint64
GetID() uint64

// Register an incoming request from a client identified by a clientIdentifier
// The clientIdentifier needs to be unique and consistent for every client as
Expand Down
4 changes: 2 additions & 2 deletions pkg/tracker/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func TestRotation(t *testing.T) {
assert.NoError(t, err)

for i := 0; i < 3; i++ {
assert.Equal(t, int(trk.secondaryStructure.GetId()-trk.mainStructure.GetId()), 1)
assert.Equal(t, int(trk.secondaryStructure.GetID()-trk.mainStructure.GetID()), 1)
time.Sleep(1 * time.Second)
}

assert.True(t, trk.secondaryStructure.GetId() >= 2)
assert.True(t, trk.secondaryStructure.GetID() >= 2)
}

0 comments on commit 00afae1

Please sign in to comment.