veyron2/storage: Make the client library thinner.
Forked from Ken's original change (since he's on vacation):
https://veyron-review.googlesource.com/#/c/3527
This change also adapts to the new transaction model where objects
in the transaction are named relative to the transaction's name.
Without this change, clients needed to do a bunch of name joining:
st := vstore.New(storeName)
// rootName is relative to storeName.
tid := st.BindTransactionRoot(rootName).CreateTransaction(ctx)
tname := naming.Join(rootName, tid)
// obj1Name is relative to rootName.
obj1 := st.BindObject(naming.Join(tname, obj1Name)).Put(...)
st.BindTransaction(tname).Commit(ctx)
The new client code looks like:
st := vstore.New()
// rootName is a full name.
tx := st.NewTransaction(ctx, rootName)
// obj1Name is relative to rootName.
obj1 := tx.Bind(obj1Name).Put(...)
tx.Commit(ctx)
Change-Id: I34a40a9020c4716c7550da10c6c14d2aa090c648
13 files changed