-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ucanto server onInvocationHandled callback #169
Comments
It is also worth pointing out that Which in turn has both So you should be able to store invocation block either in the handler or use a decorator to do it before or after handler runs. Unfortunately we do not retain the CAR CID we received the invocation from, perhaps we could add it as metadata to invocation / delegation if it's needed. |
Also please note that assumption here is incorrect
Above seems to assume there will be a single invocation in the CAR, but in practice it could be multiple each corresponding to won root. I also don't think body should be base64 encoded string (unless it's some other AWS quirk) |
@vasco-santos from our conversation I was under impression that ideally we'd just add Would that be sufficient or do we need more than that ? |
My initial goal was to make it in a way that all handlers could benefit from this out of the box. However, we are now seeing a use case that makes us need to rethink this. So, adding a wrapper on the handler will actually need to be the way to go.
Yeah, is AWS quirk.
Oh yes, this is good to know!
I think this is enough, but I still want to make sure if we want the actual CAR cid. I will sync with Oli on this too before |
Adds kinesis ucan log stream to ucanto service. Once a UCAN invocation is handled by the service, it is sent to Amazon Kinesis data streams for post processing (JSON with invocation CID, invocation bytes, and decoded invocation). Kinesis log stream has its own stack named `UcanStreamStack` which will include resources needed for post processing of ucan stream ops. `ApiStack` depends on `UcanStreamStack` given it will use its stream, as well as its data further down the line to get content like user facing stats Per https://www.notion.so/UCAN-LOG-0f3870fc4b404f5cbf646bf16b463365 Implementation details: - Invocation view content - `{ carCid: string, value: { att: UCAN.Capabilities, aud: 'did:${string}:${string}', iss: 'did:${string}:${string}' } }` - having att, audience and issuer should be enough for all the operations we intend to perform. Skipped `prf`, `exp`, `nbf`, `fct`, `nnc`, `v`, and `signature`. - see format in comment below Other notes: - SST Kinesis guide: https://sst.dev/examples/how-to-use-kinesis-data-streams-in-your-serverless-app.html - we are configuring 365 days for now https://docs.aws.amazon.com/cdk/api/v1/docs/aws-kinesis-readme.html#streams - aws related deps updated to use same everywhere - we are currently doing redundant encodings/decodings that could be avoided if we do storacha/ucanto#169 - Follow up PRs will be created with consumers: - data aggregation lambda for user facing stats - dynamoDB - ... - NOTE: they can start from before as we talked https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-lambda-event-sources.KinesisEventSourceProps.html#properties - we need to define a partition key, but we do not need to commit now to one. Only by the time we want more shards for scaling up Follow ups: - #98 Co-authored-by: Alan Shaw <[email protected]>
We are implementing
store/*
+upload/*
in https://github.com/web3-storage/upload-api/ and we want to perform asynchronous post processing on ucan invocations handled by the upload-api service.We currently need to decode the CBOR in the end of the invocation handling to properly add it to our processing system.
Having ucanto-server to support something like
onInvocationHandled
callback inServer.create
or emitting an Event would be great to pass the handled CBOR invocation. Thoughts about this @Gozala ?The text was updated successfully, but these errors were encountered: