Skip to content

Commit c44fdd2

Browse files
Fixed a misspelling of identifier in datastore accessors
1 parent 3d7a50b commit c44fdd2

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

Sources/CodableDatastore/Datastore/Datastore.swift

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ extension Datastore {
267267

268268
let versionData = try Data(self.version)
269269

270-
for try await (idenfifier, instance) in primaryIndex {
270+
for try await (identifier, instance) in primaryIndex {
271271
defer { index += 1 }
272272

273273
/// Notify progress handlers we are starting an entry.
@@ -278,11 +278,11 @@ extension Datastore {
278278
let instanceData = try await encoder(instance)
279279

280280
if rebuildPrimaryIndex {
281-
let insertionCursor = try await transaction.primaryIndexCursor(inserting: idenfifier, datastoreKey: key)
281+
let insertionCursor = try await transaction.primaryIndexCursor(inserting: identifier, datastoreKey: key)
282282

283283
try await transaction.persistPrimaryIndexEntry(
284284
versionData: versionData,
285-
identifierValue: idenfifier,
285+
identifierValue: identifier,
286286
instanceData: instanceData,
287287
cursor: insertionCursor,
288288
datastoreKey: key
@@ -305,7 +305,7 @@ extension Datastore {
305305
/// Grab a cursor to insert the new value in the index.
306306
let updatedValueCursor = try await transaction.directIndexCursor(
307307
inserting: updatedValue.indexed,
308-
identifier: idenfifier,
308+
identifier: identifier,
309309
indexName: indexName,
310310
datastoreKey: key
311311
)
@@ -314,7 +314,7 @@ extension Datastore {
314314
try await transaction.persistDirectIndexEntry(
315315
versionData: versionData,
316316
indexValue: updatedValue.indexed,
317-
identifierValue: idenfifier,
317+
identifierValue: identifier,
318318
instanceData: instanceData,
319319
cursor: updatedValueCursor,
320320
indexName: indexName,
@@ -332,15 +332,15 @@ extension Datastore {
332332
/// Grab a cursor to insert the new value in the index.
333333
let updatedValueCursor = try await transaction.secondaryIndexCursor(
334334
inserting: updatedValue.indexed,
335-
identifier: idenfifier,
335+
identifier: identifier,
336336
indexName: indexName,
337337
datastoreKey: self.key
338338
)
339339

340340
/// Insert it.
341341
try await transaction.persistSecondaryIndexEntry(
342342
indexValue: updatedValue.indexed,
343-
identifierValue: idenfifier,
343+
identifierValue: identifier,
344344
cursor: updatedValueCursor,
345345
indexName: indexName,
346346
datastoreKey: self.key
@@ -744,9 +744,9 @@ extension Datastore {
744744
// MARK: - Observation
745745

746746
extension Datastore {
747-
public func observe(_ idenfifier: IdentifierType) async throws -> some TypedAsyncSequence<ObservedEvent<IdentifierType, InstanceType>> & Sendable {
747+
public func observe(_ identifier: IdentifierType) async throws -> some TypedAsyncSequence<ObservedEvent<IdentifierType, InstanceType>> & Sendable {
748748
try await self.observe()
749-
.filter { $0.id == idenfifier }
749+
.filter { $0.id == identifier }
750750
}
751751

752752
public func observe() async throws -> some TypedAsyncSequence<ObservedEvent<IdentifierType, InstanceType>> & Sendable {
@@ -781,9 +781,9 @@ extension Datastore where AccessMode == ReadWrite {
781781
/// - Note: If you instance conforms to Identifiable, it it preferable to use ``persist(_:)`` instead.
782782
/// - Parameters:
783783
/// - instance: The instance to persist.
784-
/// - idenfifier: The unique identifier to use to reference the item being persisted.
784+
/// - identifier: The unique identifier to use to reference the item being persisted.
785785
@discardableResult
786-
public func persist(_ instance: InstanceType, to idenfifier: IdentifierType) async throws -> InstanceType? {
786+
public func persist(_ instance: InstanceType, to identifier: IdentifierType) async throws -> InstanceType? {
787787
try await warmupIfNeeded()
788788

789789
let updatedDescriptor = try self.generateUpdatedDescriptor()
@@ -799,7 +799,7 @@ extension Datastore where AccessMode == ReadWrite {
799799

800800
let existingEntry: (cursor: any InstanceCursorProtocol, instance: InstanceType, versionData: Data, instanceData: Data)? = try await {
801801
do {
802-
let existingEntry = try await transaction.primaryIndexCursor(for: idenfifier, datastoreKey: self.key)
802+
let existingEntry = try await transaction.primaryIndexCursor(for: identifier, datastoreKey: self.key)
803803

804804
let existingVersion = try Version(existingEntry.versionData)
805805
let decoder = try self.decoder(for: existingVersion)
@@ -822,13 +822,13 @@ extension Datastore where AccessMode == ReadWrite {
822822
let existingInstance = existingEntry?.instance
823823
let insertionCursor: any InsertionCursorProtocol = try await {
824824
if let existingEntry { return existingEntry.cursor }
825-
return try await transaction.primaryIndexCursor(inserting: idenfifier, datastoreKey: self.key)
825+
return try await transaction.primaryIndexCursor(inserting: identifier, datastoreKey: self.key)
826826
}()
827827

828828
if let existingEntry {
829829
try await transaction.emit(
830830
event: .updated(
831-
id: idenfifier,
831+
id: identifier,
832832
oldEntry: ObservationEntry(
833833
versionData: existingEntry.versionData,
834834
instanceData: existingEntry.instanceData
@@ -843,7 +843,7 @@ extension Datastore where AccessMode == ReadWrite {
843843
} else {
844844
try await transaction.emit(
845845
event: .created(
846-
id: idenfifier,
846+
id: identifier,
847847
newEntry: ObservationEntry(
848848
versionData: versionData,
849849
instanceData: instanceData
@@ -856,7 +856,7 @@ extension Datastore where AccessMode == ReadWrite {
856856
/// Persist the entry in the primary index
857857
try await transaction.persistPrimaryIndexEntry(
858858
versionData: versionData,
859-
identifierValue: idenfifier,
859+
identifierValue: identifier,
860860
instanceData: instanceData,
861861
cursor: insertionCursor,
862862
datastoreKey: self.key
@@ -876,7 +876,7 @@ extension Datastore where AccessMode == ReadWrite {
876876
/// Grab a cursor to the old value in the index.
877877
let existingValueCursor = try await transaction.directIndexCursor(
878878
for: existingValue.indexed,
879-
identifier: idenfifier,
879+
identifier: identifier,
880880
indexName: indexName,
881881
datastoreKey: self.key
882882
)
@@ -893,7 +893,7 @@ extension Datastore where AccessMode == ReadWrite {
893893
/// Grab a cursor to insert the new value in the index.
894894
let updatedValueCursor = try await transaction.directIndexCursor(
895895
inserting: updatedValue.indexed,
896-
identifier: idenfifier,
896+
identifier: identifier,
897897
indexName: indexName,
898898
datastoreKey: self.key
899899
)
@@ -902,7 +902,7 @@ extension Datastore where AccessMode == ReadWrite {
902902
try await transaction.persistDirectIndexEntry(
903903
versionData: versionData,
904904
indexValue: updatedValue.indexed,
905-
identifierValue: idenfifier,
905+
identifierValue: identifier,
906906
instanceData: instanceData,
907907
cursor: updatedValueCursor,
908908
indexName: indexName,
@@ -915,7 +915,7 @@ extension Datastore where AccessMode == ReadWrite {
915915
/// Grab a cursor to the old value in the index.
916916
let existingValueCursor = try await transaction.secondaryIndexCursor(
917917
for: existingValue.indexed,
918-
identifier: idenfifier,
918+
identifier: identifier,
919919
indexName: indexName,
920920
datastoreKey: self.key
921921
)
@@ -932,15 +932,15 @@ extension Datastore where AccessMode == ReadWrite {
932932
/// Grab a cursor to insert the new value in the index.
933933
let updatedValueCursor = try await transaction.secondaryIndexCursor(
934934
inserting: updatedValue.indexed,
935-
identifier: idenfifier,
935+
identifier: identifier,
936936
indexName: indexName,
937937
datastoreKey: self.key
938938
)
939939

940940
/// Insert it.
941941
try await transaction.persistSecondaryIndexEntry(
942942
indexValue: updatedValue.indexed,
943-
identifierValue: idenfifier,
943+
identifierValue: identifier,
944944
cursor: updatedValueCursor,
945945
indexName: indexName,
946946
datastoreKey: self.key
@@ -966,14 +966,14 @@ extension Datastore where AccessMode == ReadWrite {
966966
}
967967

968968
@discardableResult
969-
public func delete(_ idenfifier: IdentifierType) async throws -> InstanceType {
970-
guard let deletedInstance = try await deleteIfPresent(idenfifier)
969+
public func delete(_ identifier: IdentifierType) async throws -> InstanceType {
970+
guard let deletedInstance = try await deleteIfPresent(identifier)
971971
else { throw DatastoreInterfaceError.instanceNotFound }
972972
return deletedInstance
973973
}
974974

975975
@discardableResult
976-
public func deleteIfPresent(_ idenfifier: IdentifierType) async throws -> InstanceType? {
976+
public func deleteIfPresent(_ identifier: IdentifierType) async throws -> InstanceType? {
977977
try await warmupIfNeeded()
978978

979979
return try await persistence._withTransaction(
@@ -983,7 +983,7 @@ extension Datastore where AccessMode == ReadWrite {
983983
/// Get a cursor to the entry within the primary index.
984984
let existingEntry: (cursor: any InstanceCursorProtocol, instanceData: Data, versionData: Data)
985985
do {
986-
existingEntry = try await transaction.primaryIndexCursor(for: idenfifier, datastoreKey: self.key)
986+
existingEntry = try await transaction.primaryIndexCursor(for: identifier, datastoreKey: self.key)
987987
} catch DatastoreInterfaceError.instanceNotFound {
988988
return nil
989989
} catch DatastoreInterfaceError.datastoreKeyNotFound {
@@ -1003,7 +1003,7 @@ extension Datastore where AccessMode == ReadWrite {
10031003

10041004
try await transaction.emit(
10051005
event: .deleted(
1006-
id: idenfifier,
1006+
id: identifier,
10071007
oldEntry: ObservationEntry(
10081008
versionData: existingEntry.versionData,
10091009
instanceData: existingEntry.instanceData
@@ -1025,7 +1025,7 @@ extension Datastore where AccessMode == ReadWrite {
10251025
/// Grab a cursor to the old value in the index.
10261026
let existingValueCursor = try await transaction.directIndexCursor(
10271027
for: existingValue.indexed,
1028-
identifier: idenfifier,
1028+
identifier: identifier,
10291029
indexName: indexName,
10301030
datastoreKey: self.key
10311031
)
@@ -1042,7 +1042,7 @@ extension Datastore where AccessMode == ReadWrite {
10421042
/// Grab a cursor to the old value in the index.
10431043
let existingValueCursor = try await transaction.secondaryIndexCursor(
10441044
for: existingValue.indexed,
1045-
identifier: idenfifier,
1045+
identifier: identifier,
10461046
indexName: indexName,
10471047
datastoreKey: self.key
10481048
)

0 commit comments

Comments
 (0)