Skip to content

Commit

Permalink
partial fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gunplar committed Sep 13, 2024
1 parent c7072d0 commit 07d9039
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ WHERE relname IN ('$NAKSHA_TXN_SEQ', '$NAKSHA_MAP_SEQ') AND relnamespace=${defau
mode: FetchMode = FETCH_ALL
): List<Tuple?> {
TODO("Implement getLatestTuples")
// val readFeatures = ReadFeatures(collection.id)
// readFeatures.featureIds.add(featureId)
// val response = PgReader(session, readFeatures).execute().proxy(SuccessResponse::class)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@ class DeleteFeature(session: PgSession) : UpdateFeature(session) {
override fun execute(collection: PgCollection, write: Write): Tuple {
val featureId = write.featureId ?: throw NakshaException(NakshaError.ILLEGAL_ARGUMENT, "No feature ID provided")

var feature:NakshaFeature = null
val readFeatures = ReadFeatures(collection.id)
readFeatures.featureIds.add(featureId)
val response = PgReader(session, readFeatures).execute().proxy(SuccessResponse::class)
if (!response.features.isEmpty())
{
feature = response.features.first()
}
session.storage.getLatestTuples()
val tuples = session.storage.getLatestTuples(
conn = session.usePgConnection(),
mapId = session.map,
collectionId = collection.id,
featureIds = arrayOf(featureId)
)

if (tuples.isEmpty()) {
TODO("feature does not exist in head, should somehow return delete success but with a tuple")
}

val tuple = tuples.first()

val tupleNumber = newFeatureTupleNumber(collection, featureId, session)
val flags = resolveFlags(collection, session).action(Action.DELETED)
val tuple = tuple(
session.storage,
tupleNumber,
feature,
metadata(tupleNumber, feature, featureId, flags),
write.attachment,
flags
)

// Only modify head, hst and del tables if feature exists
if (feature != null) {
// If hst table enabled
Expand Down

0 comments on commit 07d9039

Please sign in to comment.