Durable Object ID
The DurableObjectId
interface refers to a new or existing Durable Object instance. This interface is most frequently used by DurableObjectNamespace::get
to obtain a stub for submitting requests to a Durable Object instance.
Note that creating an ID for a Durable Object instance does not create the Durable Object. The Durable Object is created lazily after calling DurableObjectNamespace::get
to create a DurableObjectStub
from a DurableObjectId
. This ensures that objects are not constructed until they are actually accessed.
toString
converts a DurableObjectId
to a 64 digit hex string. This string is useful for logging purposes or storing the DurableObjectId
elsewhere, for example, in a session cookie. This string can be used to reconstruct a DurableObjectId
via DurableObjectNamespace::idFromString
.
- None.
- A 64 digit hex string.
equals
is used to compare equality between two instances of DurableObjectId
.
- A required
DurableObjectId
to compare against.
- A boolean. True if equal and false otherwise.
name
is an optional property of a DurableObjectId
, which returns the name that was used to create the DurableObjectId
via DurableObjectNamespace::idFromName
. This value is undefined if the DurableObjectId
was constructed using DurableObjectNamespace::newUniqueId
.