Confused about the role of UserID
in:
type StorageRead struct {
Collection string
Key string
UserID string
}
and also in StorageWrite
, of course. Does it create a namespace? There doesn’t seem to be any server side docs for the storage engine except a pretty lacking function reference, so I haven’t found any real docs for this stuff. The client side docs have this example:
var writeObjects = new [] {
new WriteStorageObject
{
Collection = "saves",
Key = "savegame",
Value = saveGame
},
};
await client.WriteStorageObjectsAsync(session, writeObjects);
Based on this I assume that the user id is used internally to provide a namespace so that every user gets an own saveGame
entry in the saves
collection, as otherwise everyone would be overwriting the same file. Is this the case? In my case I want to store a limited history of some stuff the user has received, so should I use:
runtime.StorageRead{
Collection: "history",
Key: storageRequest.userId,
UserID: "",
}
or
runtime.StorageRead{
Collection: "history",
Key: "purchases",
UserID: storageRequest.userId,
}
in order to have an entry per user? Assuming the entry is written already.
Also, what does:
StorageRead(ctx context.Context, reads []*StorageRead) ([]*api.StorageObject, error)`
do if one entry in the array is missing? In my case I’d always have just one requested entry. Does it give an error or return an empty array? Should all reads be first checked with StorageList
? These things would be nice to have in the function reference.