Skip to content

Commit 35692d7

Browse files
committed
remove unused collections operations
1 parent db502ad commit 35692d7

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

storage/operation/collections.go

-17
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@ func RemoveCollection(w storage.Writer, collID flow.Identifier) error {
2626
return RemoveByKey(w, MakePrefix(codeCollection, collID))
2727
}
2828

29-
// IndexCollectionPayload will overwrite any existing index, which is acceptable
30-
// because the blockID is derived from txIDs within the payload, ensuring its uniqueness.
31-
func IndexCollectionPayload(w storage.Writer, blockID flow.Identifier, txIDs []flow.Identifier) error {
32-
return UpsertByKey(w, MakePrefix(codeIndexCollection, blockID), txIDs)
33-
}
34-
35-
// LookupCollection looks up the collection for a given cluster payload.
36-
func LookupCollectionPayload(r storage.Reader, blockID flow.Identifier, txIDs *[]flow.Identifier) error {
37-
return RetrieveByKey(r, MakePrefix(codeIndexCollection, blockID), txIDs)
38-
}
39-
4029
// UnsafeIndexCollectionByTransaction inserts a collection id keyed by a transaction id
4130
// Unsafe because a transaction can belong to multiple collections, indexing collection by a transaction
4231
// will overwrite the previous collection id that was indexed by the same transaction id
@@ -54,12 +43,6 @@ func LookupCollectionByTransaction(r storage.Reader, txID flow.Identifier, colle
5443
return RetrieveByKey(r, MakePrefix(codeIndexCollectionByTransaction, txID), collectionID)
5544
}
5645

57-
// RemoveCollectionPayloadIndices removes a collection id indexed by a block id
58-
// any error returned are exceptions
59-
func RemoveCollectionPayloadIndices(w storage.Writer, blockID flow.Identifier) error {
60-
return RemoveByKey(w, MakePrefix(codeIndexCollection, blockID))
61-
}
62-
6346
// RemoveCollectionByTransactionIndex removes a collection id indexed by a transaction id,
6447
// created by [UnsafeIndexCollectionByTransaction].
6548
// Any error returned is an exception.

storage/operation/collections_test.go

-35
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,5 @@ func TestCollections(t *testing.T) {
5454
})
5555
require.NoError(t, err)
5656
})
57-
58-
t.Run("Index and lookup", func(t *testing.T) {
59-
expected := unittest.CollectionFixture(1).Light()
60-
blockID := unittest.IdentifierFixture()
61-
62-
_ = db.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
63-
err := operation.UpsertCollection(rw.Writer(), &expected)
64-
assert.NoError(t, err)
65-
err = operation.IndexCollectionPayload(rw.Writer(), blockID, expected.Transactions)
66-
assert.NoError(t, err)
67-
return nil
68-
})
69-
70-
var actual flow.LightCollection
71-
err := operation.LookupCollectionPayload(db.Reader(), blockID, &actual.Transactions)
72-
assert.NoError(t, err)
73-
assert.Equal(t, expected, actual)
74-
})
75-
76-
t.Run("Index and lookup by transaction ID", func(t *testing.T) {
77-
expected := unittest.IdentifierFixture()
78-
transactionID := unittest.IdentifierFixture()
79-
actual := flow.Identifier{}
80-
81-
_ = db.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
82-
err := operation.UnsafeIndexCollectionByTransaction(rw.Writer(), transactionID, expected)
83-
assert.NoError(t, err)
84-
return nil
85-
})
86-
87-
err := operation.LookupCollectionByTransaction(db.Reader(), transactionID, &actual)
88-
assert.NoError(t, err)
89-
90-
assert.Equal(t, expected, actual)
91-
})
9257
})
9358
}

0 commit comments

Comments
 (0)