https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • j

    john.spurlock

    07/05/2021, 3:13 PM
    I agree, you can get your own hex id from inside the DO using
    state.id
    , but it would be nice to have the other stub specs (
    name
    ,
    jurisdiction
    if applicable) without having to pass them down into every call (what I'm doing now).
  • g

    Greylock

    07/05/2021, 3:13 PM
    not sure if theres an example, but im rolling my own durable based auth also
  • g

    Greylock

    07/05/2021, 3:14 PM
    the documentation isn't really explicit on how the durable should communicate with the worker, so im just having it behave like a rest api in the sense that the worker can perform ``GET``, ``POST``, ``PUT`` and ``PATCH`` operations on the users DO
  • g

    Greylock

    07/05/2021, 3:15 PM
    still not sure how im gonna handle TOTP and stuff (yet)
  • t

    Toby

    07/05/2021, 6:13 PM
    It's probably been asked before but is there any way to list / delete Durable Objects?
  • w

    Walshy | Pages

    07/05/2021, 6:15 PM
    https://developers.cloudflare.com/workers/runtime-apis/durable-objects#methods
  • t

    Toby

    07/05/2021, 6:28 PM
    @User Thanks for the quick answer, but I don't mean the DO's internal storage, I mean the whole thing.
  • t

    Toby

    07/05/2021, 6:29 PM
    So when I initialize a durable object it gets created somewhere on a server, but once I don't need it anymore how do I get rid of it?
  • t

    Toby

    07/05/2021, 6:32 PM
    Or is my fundamental understanding of how Durable Objects work just wrong?
  • j

    john.spurlock

    07/05/2021, 8:01 PM
    Your understanding is spot on. You can't do this as of today, you must remember the id/name for each object yourself (maybe in another DO!) and
    deleteAll
    from within each instance. I seem to recall someone from cf mentioning they are planning to have some sort of management api surface for DOs as part of the standard cf rest api by the time DOs hit GA, but I couldn't find it in scrollback, maybe a different channel.
  • t

    Toby

    07/05/2021, 8:03 PM
    So if I clear its internal storage we're good?
  • j

    john.spurlock

    07/05/2021, 8:05 PM
    yep - that's the only storage you're charged for, and make sure you don't amass 10gb across all instances in your account during the beta
  • t

    Toby

    07/05/2021, 8:06 PM
    Does that even work when I'm using web sockets within my DO?
  • j

    john.spurlock

    07/05/2021, 8:08 PM
    hehe, yea the
    state.storage
    is available in any DO instance constructor, including ones that handle websockets. Websockets themselves have no durable state outside of the instance that you need to clean up.
  • t

    Toby

    07/05/2021, 8:08 PM
    Thank you John for the clarification 🙂
  • t

    Toby

    07/05/2021, 8:10 PM
    @User Make this man a Community Champion 👏😊
  • g

    Greg Brimble | Cloudflare Pages

    07/06/2021, 2:10 PM
    KV is encrypted with 256-bit AES-GCM. Is DO storage the same? Can't see it said definitively anywhere.
  • b

    brett

    07/06/2021, 6:04 PM
    DO storage is encrypted at rest
  • g

    Greg Brimble | Cloudflare Pages

    07/06/2021, 6:06 PM
    Same standard?
  • b

    brett

    07/06/2021, 6:19 PM
    It's a different system but also AES256
  • g

    Greg Brimble | Cloudflare Pages

    07/06/2021, 6:19 PM
    Awesome, thanks!
  • t

    Toby

    07/06/2021, 9:25 PM
    Does a DOs internal storage also have up to a 60 second delay until it can be reliably read back?
  • e

    eidam | SuperSaaS

    07/06/2021, 9:26 PM
    nono, DOs storage is consistent, as there is no global replication in play (you always have one DO instance per DO id running, talking to a single storage)
  • t

    Toby

    07/06/2021, 9:27 PM
    @User Thank you 🙂
  • b

    brett

    07/06/2021, 9:27 PM
    Yep, to be clear it is replicated, so that we can fail over if a data center were to suddenly go offline, but it's not like Workers KV
  • b

    brett

    07/06/2021, 9:28 PM
    Speaking of listing objects (from earlier), if anyone wants to test it out, I can give you the details
  • e

    eidam | SuperSaaS

    07/06/2021, 9:28 PM
    yes please! 🙋‍♂️
  • w

    Wallacy

    07/06/2021, 9:45 PM
    will be nice!
  • b

    brett

    07/06/2021, 9:51 PM
    I've DM'd both of you, and probably tomorrow I'll post the details here for the channel
  • j

    jed

    07/07/2021, 12:27 AM
    i’m looking to mock Durable Object ID generation… can you tell me what flavor of crypto is used to ensure that a given ID was generated for a given DO? (ie, can’t just use random strings for
    idFromString
    )
1...122123124...567Latest