Standard LogicalResults Per Service
Revision as of 08:04, 27 November 2021 by Sven the Barbarian (talk | contribs) (→LogicalSortedRequest)
Overview
Standards for services that handle LogicalResults
DynamoDB structure
LogicalResultsMain
A cached result set for logicals
{
logicalResultId: "xxx", // hash of logical element
logicalElement: {}, // full element being processed
logicalType: "xx", // same filterType
status: "xxx", // "processing"|"complete",
expiryTime: "xx",
uniqueRequestId: "xx", used for idempotence when first process request called, in case that invocation fails and restarts, can be removed when set to complete
}
- partition key: logicalResultId
- sort key: (none)
LogicalResultsData
Caches found results for logical elements
{
logicalResultId: xxx,
dataId: xxx // eg: one sellofferId
}
- partition key: resultId
- sort key: dataId
LogicalAwaitingStep
Temporary link/flow table for ProcessLogical requests that are waiting another step to finish, can save any type of awaiting id here
{
awaitingId: "xx",
logicalResultId: "xx",
timestamp: "xx", //when record created
uniqueRequestId: "xx", optional, used for idempotence when first process request called in a Lambda wants only one request to process, in case first invocation fails and restarts
}
- partition key: awaitingId
- sort key: logicalResultId
- if different parts of a flow use the same awaitingId we could perhaps prefix it
LogicalSortedRequest
Temporary link/flow table for ProcessLogical requests that get passed to a sorted searchResult process, optionally some filtering applied.
{
searchTypeSortResultId: "xx",
logicalResultId: "xx",
comparison: "xx", // equals/greaterThan/lessThan/greaterThanEquals/lessThanEquals, optional, will filter the sortResult data before saving into LogicalResultsData
comparisonValue: "xx", //used if comparison set (could dig LogicalResultsMain but putting it here might allow for more complex handling)
excludeEmpty: true,
timestamp: "xx", //when record created
copyDataUniqueRequestId: "xx", used for idempotence and to mark this record is in process of being copied
}
- partition key: searchTypeSortResultId
- sort key: logicalResultId
- searchTypeSortResultId: {searchType}_{sortResultId}
- is temporary, after sortResult/copying is complete send OutProcessLogical message and delete LogicalSortedRequests record
- will copy the identifier id as the logicalResult dataId
- comparison is optional, but should always have otherwise could use searchResult instead of sortResult (need to create another flow/table for that)
- flow starts searchResult with sortField, once complete triggers CompleteLogicalSortedRequest that copies data to LogicalResultsData table
LogicalHandlerRequest
- not yet applied
Temporary link/flow records for ProcessLogical requests that get passed to all Sell Offer Handler services as a new handler level complexFilter.
{
logicalResultId: "xx",
logicalElement: {}, // needed for logicalTag (? maybe not, just query LogicalResultMain?)
waitingHandlers: [] // string set, remove each handler from this after copying it's results to SellOfferManager LogicalResults table
timestamp: "xx", //when record created
}
- partition key: logicalResultId
- is temporary, after waitingHandlers is empty send OutProcessLogical message and delete HandlerLogicalRequests record
- flow starts complexFilter for each handler service, once complete triggers a lambda that copies Handler LogicalResults data to SellOfferManager LogicalResults table, combining all Handler results, removes Handler from waitingHandlers. Once all are complete (waitingHandlers empty) we can send a message saying the SellOfferManager level logical results are complete
- Logical element that gets passed to handler services must match the element received by SellOfferManager, so can match records