Add an internal API to get a read fd for a content object

This will be used by the static deltas work.
This commit is contained in:
Colin Walters 2015-02-05 21:49:49 -05:00
parent 1fdecbd263
commit be4ad54800
2 changed files with 25 additions and 0 deletions

View File

@ -229,4 +229,11 @@ _ostree_repo_commit_trusted_content_bare (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
gboolean
_ostree_repo_read_bare_fd (OstreeRepo *self,
const char *checksum,
int *out_fd,
GCancellable *cancellable,
GError **error);
G_END_DECLS

View File

@ -1875,6 +1875,24 @@ set_info_from_filemeta (GFileInfo *info,
return xattrs;
}
gboolean
_ostree_repo_read_bare_fd (OstreeRepo *self,
const char *checksum,
int *out_fd,
GCancellable *cancellable,
GError **error)
{
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
g_assert (self->mode == OSTREE_REPO_MODE_BARE ||
self->mode == OSTREE_REPO_MODE_BARE_USER);
_ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, self->mode);
return gs_file_openat_noatime (self->objects_dir_fd, loose_path_buf, out_fd,
cancellable, error);
}
/**
* ostree_repo_load_file:
* @self: Repo