eparrot
02/22/2023, 1:44 PMeparrot
02/22/2023, 1:44 PMkian
02/22/2023, 1:46 PMFetcher
used around the place for Service Bindings, mTLS certificates & Workers for Platforms
They all expose a fetch
method, different to the global one in some way.
In DO's case, it sends the request to your Durable Object.
In Service Bindings (and WfP) case, it sends it to the bound Worker.
In mTLS certificates case, it'll present a client certificate with the request.kian
02/22/2023, 1:46 PMeparrot
02/22/2023, 1:47 PMkian
02/22/2023, 1:47 PMhttp://lol.bar
or you can pass a URL w/ query strings if you prefer to use those rather than headers.eparrot
02/22/2023, 1:48 PMkian
02/22/2023, 1:50 PMfetch('/counter')
- but now requires a full URL - even if the scheme/hostname is pretty much meaningless unless you choose to use it in your DO.john.spurlock
02/22/2023, 2:51 PMeparrot
02/22/2023, 2:55 PM{
"xactnUnixTime": "bigint",
"otherTransactionAttribute": "string",
"transactionArguments": {
"transactionArgument": {
"argIndex:": "integer",
"argName": "string",
"argValue": "string"
}
}
}
I'm envisioning each record will be an instance of a DO with a xactnId as the name. If I have 100,000 recs and I need to get all recs with a transactionArgument.argName equal to a specific string and transactionArgument.argValue equal to a specific string - is that something doable with DO with decent performance and without writing tortured code to do it (a loop is fine)? Is it a reasonable use case for DO? I know storing it in a database or a json file, it's very quick to come back.Adrian (Launchpad Cohort)
02/22/2023, 7:19 PMjohn.spurlock
02/22/2023, 7:23 PMAdrian (Launchpad Cohort)
02/22/2023, 7:27 PMcrabmusket
02/22/2023, 11:20 PMckoeninger
02/22/2023, 11:23 PMeparrot
02/22/2023, 11:35 PMLarry
02/23/2023, 12:40 AMstorage.list(options)
accepts a prefix
option so you can get the storage key/value pairs that start with your Xactnld. It also has paging support.eparrot
02/23/2023, 12:56 AMaa
02/23/2023, 10:15 AMcrabmusket
02/23/2023, 11:08 AMHardAtWork
02/23/2023, 11:10 AMjs
export class DO {
async fetch() {
return new Response(
((
await (await fetch("https://www.cloudflare.com/cdn-cgi/trace")).text()
).match(/^colo=(.+)/m) as string[])[1],
);
}
}
aa
02/23/2023, 11:10 AMHardAtWork
02/23/2023, 11:10 AMaa
02/23/2023, 11:11 AMrequest.cf
but I don't have access to the incoming request in the area of code I'm in, but this I can do from anywhere.aa
02/23/2023, 11:12 AMLarry
02/23/2023, 10:56 PMeparrot
02/23/2023, 11:11 PMLarry
02/23/2023, 11:18 PMckoeninger
02/23/2023, 11:41 PMeparrot
02/24/2023, 12:38 AM