Mercurial > nomad > experimental
changeset 1210:025b8d68c981
objstore: add obj_read helper to read arbitrary parts of objvers
Currently, this is a trivial function but it'll get more complicated in the
next few commits.
While it doesn't use a transaction (it is the read op!), it makes sense to
have it use the same naming scheme as other obj_* functions.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 13 Apr 2020 20:05:49 -0400 |
parents | d0c9f6b1d009 |
children | a525d07c3fda |
files | src/objstore/obj_txn.c src/objstore/objstore_impl.h |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/obj_txn.c Mon Apr 13 15:46:30 2020 -0400 +++ b/src/objstore/obj_txn.c Mon Apr 13 20:05:49 2020 -0400 @@ -56,6 +56,12 @@ return 0; } +ssize_t obj_read(struct objver *ver, void *buf, size_t len, + uint64_t offset) +{ + return ver->obj->ops->read(ver, buf, len, offset); +} + static int __obj_setattr_perform(struct txn *txn, struct txn_entry *entry) { struct objver *ver = entry->setattr.ver;
--- a/src/objstore/objstore_impl.h Mon Apr 13 15:46:30 2020 -0400 +++ b/src/objstore/objstore_impl.h Mon Apr 13 20:05:49 2020 -0400 @@ -68,6 +68,8 @@ extern int obj_cow(struct txn *txn, struct objstore_open_obj_info *open); extern int obj_create(struct txn *txn, const struct nattr *attrs, struct noid *oid, const struct noid *parent); +extern ssize_t obj_read(struct objver *ver, void *buf, size_t len, + uint64_t offset); extern void obj_setattr(struct txn *txn, struct objver *ver, const struct nattr *attrs, unsigned valid); extern void obj_write(struct txn *txn, struct objver *ver, struct buffer *buf,