> I'd need to create a unique name to use to name an entity group
> without using any datastore operations.
I don't understand what you're trying to do. Entity groups don't have names.
Dave.
> Entity groups are named by the key of the root, which can be
> constructed from a kind and a key name.
Okay, that's not really the entity group being named, but the root
entity being named.
> Suppose that I want to atomically create an entity group with two
> nodes, one the parent of the other.
But *why* exactly do you want to do this? In your original email, you
said "Is there any way to get the hostname, IP, or MAC address where
the GAE app is running?", which is a fundamentally flawed question.
Your App Engine application doesn't run on a single machine, IP or MAC
address, because it runs on potentially hundreds of machines
concurrently. If you're wanting to use the aforementioned details to
get a unique identifier you're also doomed to failure, because there's
no guarantee that there will be only one instance of your application
on a machine at any one time.
If you tell us more about *what* you're trying to achieve, rather than
*how* you think you can achieve it, we can give you a better idea.
Dave.
>> > Suppose that I want to atomically create an entity group with two
>> > nodes, one the parent of the other.
>> But *why* exactly do you want to do this?
>
> Because I want "a set of one or more entities that can be manipulated
> in a single transaction. Entity group relationships tell App Engine to
> store several entities in the same part of the distributed network. A
> transaction sets up datastore operations for an entity group, and all
> of the operations are applied as a group, or not at all if the
> transaction fails."
Yes, I understand transactions and entity groups. Why do you need to
create an entity group *atomically*?
> The fact that GAE uses many machines and concurrently is why the full
> hostname, IP, or MAC address or some other machine identifier is
> useful in creating a unique identifier on GAE. (If my application
> always ran on the same machine, the process id and time would be
> sufficient.)
If you create a new entity, it will automatically be assigned a unique
key at the datastore level. What's wrong with just using that?
Dave.
>> Yes, I understand transactions and entity groups. Why do you need to
>> create an entity group *atomically*?
>
> For the same reason that transactions are useful - incomplete groups
> are wrong (in my application) and I'd rather not deal with them.
A two-stage insertion would work fine, then. Insert the first object
with a "not-ready" flag set, insert the second object, then go back
and flip the "not-ready" flag.
>> If you create a new entity, it will automatically be assigned a unique
>> key at the datastore level. What's wrong with just using that?
>
> Each db.put has significant overhead. If I can generate a unique name
> without a db.put, I can reduce the number of db.puts that my
> application does by a factor of 2.
Generating an application-globally-unique name is hard, and App Engine
is mainly focused on applications where the writes are few and the
reads are many. Until you've benchmarked it, it sounds like you are
prematurely optimising for an operation that should be relatively
rare, while seriously increasing the complexity of your system. Who
said the datastore would be on the same machine as the running
application, anyway?
Dave.