Skip to content

Commit bfb295a

Browse files
committed
PR(chore): Change Id to ID
1 parent 99a9a5e commit bfb295a

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

internal/db/collection_id.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -179,30 +179,30 @@ func getCollectionSets(newCollections []*client.CollectionVersion) [][]*client.C
179179
slices.Sort(circularCollectionNames)
180180

181181
var i int
182-
collectionSetIds := map[string]int{}
182+
collectionSetIDs := map[string]int{}
183183
collectionsHit := map[string]struct{}{}
184184
for _, name := range circularCollectionNames {
185185
collection := collectionsWithRelations[name]
186-
mapCollectionSetIDs(&i, collection, collectionSetIds, collectionsWithRelations, collectionsHit)
186+
mapCollectionSetIDs(&i, collection, collectionSetIDs, collectionsWithRelations, collectionsHit)
187187
}
188188

189189
collectionSetsByID := map[int][]*client.CollectionVersion{}
190190
for _, collection := range newCollections {
191-
collectionSetId, ok := collectionSetIds[collection.Name]
191+
collectionSetID, ok := collectionSetIDs[collection.Name]
192192
if !ok {
193193
// In most cases, if a collection does not form a circular set then it will not be in
194194
// collectionSetIds, and we can assign it a new, unused setID
195195
i++
196-
collectionSetId = i
196+
collectionSetID = i
197197
}
198198

199-
collectionSet, ok := collectionSetsByID[collectionSetId]
199+
collectionSet, ok := collectionSetsByID[collectionSetID]
200200
if !ok {
201201
collectionSet = make([]*client.CollectionVersion, 0, 1)
202202
}
203203

204204
collectionSet = append(collectionSet, collection)
205-
collectionSetsByID[collectionSetId] = collectionSet
205+
collectionSetsByID[collectionSetID] = collectionSet
206206
}
207207

208208
collectionSets := [][]*client.CollectionVersion{}
@@ -224,15 +224,15 @@ func getCollectionSets(newCollections []*client.CollectionVersion) [][]*client.C
224224
// Parameters:
225225
// - i: The largest setID so far assigned. This parameter is mutated by this function.
226226
// - collection: The current collection to process
227-
// - collectionSetIds: The set of already assigned setIDs mapped by collection name - this parameter will be mutated
227+
// - collectionSetIDs: The set of already assigned setIDs mapped by collection name - this parameter will be mutated
228228
// by this function
229229
// - collectionRelationsByCollectionName: The full set of relevant collections/relations mapped by collection name
230230
// - collectionsFullyProcessed: The set of collection names that have already been completely processed. If
231231
// `collection` is in this set the function will return. This parameter is mutated by this function.
232232
func mapCollectionSetIDs(
233233
i *int,
234234
collection collectionRelations,
235-
collectionSetIds map[string]int,
235+
collectionSetIDs map[string]int,
236236
collectionRelationsByCollectionName map[string]collectionRelations,
237237
collectionsFullyProcessed map[string]struct{},
238238
) {
@@ -248,20 +248,20 @@ func mapCollectionSetIDs(
248248

249249
var circleID int
250250
if circlesBackHere {
251-
if id, ok := collectionSetIds[relation]; ok {
251+
if id, ok := collectionSetIDs[relation]; ok {
252252
// If this collection has already been assigned a setID, use that
253253
circleID = id
254254
} else {
255-
collectionSetId, ok := collectionSetIds[collection.name]
255+
collectionSetID, ok := collectionSetIDs[collection.name]
256256
if !ok {
257257
// If this collection has not already been assigned a setID, it must be
258258
// the first discovered node in a new circle. Assign it a new setID,
259259
// this will be picked up by its circle-forming descendents.
260260
*i = *i + 1
261-
collectionSetId = *i
261+
collectionSetID = *i
262262
}
263-
collectionSetIds[collection.name] = collectionSetId
264-
circleID = collectionSetId
263+
collectionSetIDs[collection.name] = collectionSetID
264+
circleID = collectionSetID
265265
}
266266
} else {
267267
// If this collection and its relations does not circle back to itself, we
@@ -270,11 +270,11 @@ func mapCollectionSetIDs(
270270
circleID = *i
271271
}
272272

273-
collectionSetIds[relation] = circleID
273+
collectionSetIDs[relation] = circleID
274274
mapCollectionSetIDs(
275275
i,
276276
collectionRelationsByCollectionName[relation],
277-
collectionSetIds,
277+
collectionSetIDs,
278278
collectionRelationsByCollectionName,
279279
collectionsFullyProcessed,
280280
)
@@ -406,7 +406,7 @@ func saveBlocks(
406406
ctx context.Context,
407407
collectionSet []*client.CollectionVersion,
408408
) error {
409-
colIds := make([]cidlink.Link, 0, len(collectionSet))
409+
colIDs := make([]cidlink.Link, 0, len(collectionSet))
410410
hasSetUpdated := false
411411

412412
for _, collection := range collectionSet {
@@ -481,7 +481,7 @@ func saveBlocks(
481481
collection.CollectionID = collection.VersionID
482482
}
483483

484-
colIds = append(colIds, cid)
484+
colIDs = append(colIDs, cid)
485485

486486
if oldCol.VersionID != "" {
487487
var migration immutable.Option[string]
@@ -504,8 +504,8 @@ func saveBlocks(
504504
colSetCRDT := crdt.NewCollectionSet(collectionSet[0].CollectionID)
505505
delta := colSetCRDT.Delta()
506506

507-
links := make([]coreblock.DAGLink, 0, len(colIds))
508-
for _, colId := range colIds {
507+
links := make([]coreblock.DAGLink, 0, len(colIDs))
508+
for _, colId := range colIDs {
509509
links = append(links, coreblock.DAGLink{Link: colId})
510510
}
511511

0 commit comments

Comments
 (0)