From ec0a884627f8522083d0c623d3e894d9a14a3b34 Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Wed, 2 Aug 2017 12:48:57 -0500 Subject: [PATCH] rename/reorganize client-side libary/header --- Makefile.am | 8 +- include/bake-bulk-client.h | 139 ++++++++++++++++++++++++ include/bake-bulk.h | 125 --------------------- src/Makefile.subdir | 4 +- src/{bake-bulk.c => bake-bulk-client.c} | 0 src/bb-copy-from.c | 2 +- src/bb-copy-to.c | 2 +- src/bb-latency-bench.c | 2 +- src/bb-shutdown.c | 2 +- 9 files changed, 149 insertions(+), 135 deletions(-) create mode 100644 include/bake-bulk-client.h rename src/{bake-bulk.c => bake-bulk-client.c} (100%) diff --git a/Makefile.am b/Makefile.am index 3fa4116..eacabdb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ CLEANFILES = $(bin_SCRIPTS) MAINTAINERCLEANFILES = EXTRA_DIST = BUILT_SOURCES = -include_HEADERS = include/bake-bulk.h +include_HEADERS = include/bake-bulk.h include/bake-bulk-client.h EXTRA_DIST += \ prepare.sh @@ -26,10 +26,10 @@ AM_LIBS = AM_CXXFLAGS = $(AM_CFLAGS) -lib_LTLIBRARIES = src/libbake-bulk.la -src_libbake_bulk_la_SOURCES = +lib_LTLIBRARIES = src/libbake-bulk-client.la +src_libbake_bulk_client_la_SOURCES = -LDADD = src/libbake-bulk.la +LDADD = src/libbake-bulk-client.la pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = maint/bake-bulk.pc diff --git a/include/bake-bulk-client.h b/include/bake-bulk-client.h new file mode 100644 index 0000000..00ad495 --- /dev/null +++ b/include/bake-bulk-client.h @@ -0,0 +1,139 @@ +/* + * (C) 2016 The University of Chicago + * + * See COPYRIGHT in top-level directory. + */ + +#ifndef __BAKE_BULK_CLIENT_H +#define __BAKE_BULK_CLIENT_H + +#include + +#include "bake-bulk.h" + +/** + * Obtain identifying information for a bake target through the provided + * remote mercury address. + * + * @param [in] mecury_dest Mercury address in string form + * @param [out] bti BAKE target identifier + * @returns 0 on success, -1 on failure + */ +int bake_probe_instance( + const char *mercury_dest, + bake_target_id_t *bti); + +/** + * Create a bounded-size bulk data region. The resulting region can be + * written using bulk write operations, and can be persisted (once writes are + * complete) with a a bulk persist operation. The region is not valid for + * read access until persisted. + * + * @param [in] bti BAKE target identifier + * @param [in] region_size size of region to be created + * @param [out] rid identifier for new region + * @returns 0 on success, -1 on failure + */ +int bake_bulk_create( + bake_target_id_t bti, + uint64_t region_size, + bake_bulk_region_id_t *rid); + +/** + * Writes into a region that was previously created with bake_bulk_create(). + * Result is not guaranteed to be persistent until explicit + * bake_bulk_persist() call. + * + * Results are undefined if multiple writers (from same process or different + * processes) perform overlapping writes. + * + * @param [in] bti BAKE target identifier + * @param [in] rid identifier for region + * @param [in] region_offset offset into the target region to write + * @param [in] buf local memory buffer to write + * @param [in] buf_size size of local memory buffer to write + * @returns 0 on success, -1 on failure + */ +int bake_bulk_write( + bake_target_id_t bti, + bake_bulk_region_id_t rid, + uint64_t region_offset, + void const *buf, + uint64_t buf_size); + +/** + * Persist a bulk region. The region is considered immutable at this point + * and reads may be performed on the region. + * + * @param [in] bti BAKE target identifier + * @param [in] rid identifier for region + * @returns 0 on success, -1 on failure + */ +int bake_bulk_persist( + bake_target_id_t bti, + bake_bulk_region_id_t rid); + +/** + * Check the size of an existing region. + * + * @param [in] bti BAKE target identifier + * @param [in] rid identifier for region + * @param [out] size sizes of region + * @returns 0 on success, -1 on failure + */ +int bake_bulk_get_size( + bake_target_id_t bti, + bake_bulk_region_id_t rid, + uint64_t *region_size); + +/** + * Reads from a region that was previously persisted with bake_bulk_persist(). + * + * NOTE: for now at least, this call does not support "short" reads. It + * either succeeds in reading the requested size or not. + * + * @param [in] bti BAKE target identifier + * @param [in] rid region identifier + * @param [in] region_offset offset into the target region to read from + * @param [in] buf local memory buffer read into + * @param [in] buf_size size of local memory buffer to read into + * @returns 0 on success, -1 on failure + */ +int bake_bulk_read( + bake_target_id_t bti, + bake_bulk_region_id_t rid, + uint64_t region_offset, + void *buf, + uint64_t buf_size); + +/** + * Release local resources associated with access to a target; does not + * modify the target in any way. + * + * @param [in] bti BAKE target_identifier + */ +void bake_release_instance( + bake_target_id_t bti); + +/** + * Utility function to shut down a remote service + * + * @param [in] bti Bake target identifier + * @returns 0 on success, -1 on fialure + */ +int bake_shutdown_service(bake_target_id_t bti); + +/* NOTE: code below is a copy of the bulk portion of the proposed BAKE API. + * Commented out for now but leaving it in place for reference + */ + +/** + * Issue a no-op + * + * @param [in] bti BAKE target identifier + * @returns 0 on success, -1 on failure + */ +int bake_bulk_noop( + bake_target_id_t bti); + +#endif /* __BAKE_BULK__CLIENT_H */ diff --git a/include/bake-bulk.h b/include/bake-bulk.h index e7cf0a3..834743e 100644 --- a/include/bake-bulk.h +++ b/include/bake-bulk.h @@ -27,131 +27,6 @@ typedef struct { char data[BAKE_BULK_REGION_ID_DATA_SIZE]; } bake_bulk_region_id_t; -/** - * Obtain identifying information for a bake target through the provided - * remote mercury address. - * - * @param [in] mecury_dest Mercury address in string form - * @param [out] bti BAKE target identifier - * @returns 0 on success, -1 on failure - */ -int bake_probe_instance( - const char *mercury_dest, - bake_target_id_t *bti); - -/** - * Create a bounded-size bulk data region. The resulting region can be - * written using bulk write operations, and can be persisted (once writes are - * complete) with a a bulk persist operation. The region is not valid for - * read access until persisted. - * - * @param [in] bti BAKE target identifier - * @param [in] region_size size of region to be created - * @param [out] rid identifier for new region - * @returns 0 on success, -1 on failure - */ -int bake_bulk_create( - bake_target_id_t bti, - uint64_t region_size, - bake_bulk_region_id_t *rid); - -/** - * Writes into a region that was previously created with bake_bulk_create(). - * Result is not guaranteed to be persistent until explicit - * bake_bulk_persist() call. - * - * Results are undefined if multiple writers (from same process or different - * processes) perform overlapping writes. - * - * @param [in] bti BAKE target identifier - * @param [in] rid identifier for region - * @param [in] region_offset offset into the target region to write - * @param [in] buf local memory buffer to write - * @param [in] buf_size size of local memory buffer to write - * @returns 0 on success, -1 on failure - */ -int bake_bulk_write( - bake_target_id_t bti, - bake_bulk_region_id_t rid, - uint64_t region_offset, - void const *buf, - uint64_t buf_size); - -/** - * Persist a bulk region. The region is considered immutable at this point - * and reads may be performed on the region. - * - * @param [in] bti BAKE target identifier - * @param [in] rid identifier for region - * @returns 0 on success, -1 on failure - */ -int bake_bulk_persist( - bake_target_id_t bti, - bake_bulk_region_id_t rid); - -/** - * Check the size of an existing region. - * - * @param [in] bti BAKE target identifier - * @param [in] rid identifier for region - * @param [out] size sizes of region - * @returns 0 on success, -1 on failure - */ -int bake_bulk_get_size( - bake_target_id_t bti, - bake_bulk_region_id_t rid, - uint64_t *region_size); - -/** - * Reads from a region that was previously persisted with bake_bulk_persist(). - * - * NOTE: for now at least, this call does not support "short" reads. It - * either succeeds in reading the requested size or not. - * - * @param [in] bti BAKE target identifier - * @param [in] rid region identifier - * @param [in] region_offset offset into the target region to read from - * @param [in] buf local memory buffer read into - * @param [in] buf_size size of local memory buffer to read into - * @returns 0 on success, -1 on failure - */ -int bake_bulk_read( - bake_target_id_t bti, - bake_bulk_region_id_t rid, - uint64_t region_offset, - void *buf, - uint64_t buf_size); - -/** - * Release local resources associated with access to a target; does not - * modify the target in any way. - * - * @param [in] bti BAKE target_identifier - */ -void bake_release_instance( - bake_target_id_t bti); - -/** - * Utility function to shut down a remote service - * - * @param [in] bti Bake target identifier - * @returns 0 on success, -1 on fialure - */ -int bake_shutdown_service(bake_target_id_t bti); - -/* NOTE: code below is a copy of the bulk portion of the proposed BAKE API. - * Commented out for now but leaving it in place for reference - */ - -/** - * Issue a no-op - * - * @param [in] bti BAKE target identifier - * @returns 0 on success, -1 on failure - */ -int bake_bulk_noop( - bake_target_id_t bti); - #if 0 /// ==== Some high-level goals ==== diff --git a/src/Makefile.subdir b/src/Makefile.subdir index 1fe0472..9a7542b 100644 --- a/src/Makefile.subdir +++ b/src/Makefile.subdir @@ -1,5 +1,5 @@ -src_libbake_bulk_la_SOURCES += \ - src/bake-bulk.c +src_libbake_bulk_client_la_SOURCES += \ + src/bake-bulk-client.c bin_PROGRAMS += \ src/bake-bulk-server \ diff --git a/src/bake-bulk.c b/src/bake-bulk-client.c similarity index 100% rename from src/bake-bulk.c rename to src/bake-bulk-client.c diff --git a/src/bb-copy-from.c b/src/bb-copy-from.c index 55072b7..97f665e 100644 --- a/src/bb-copy-from.c +++ b/src/bb-copy-from.c @@ -15,7 +15,7 @@ #include "abt.h" #include "abt-snoozer.h" -#include "bake-bulk.h" +#include "bake-bulk-client.h" /* client program that will copy a bake bulk region out to a POSIX file */ diff --git a/src/bb-copy-to.c b/src/bb-copy-to.c index feafc14..df9bd27 100644 --- a/src/bb-copy-to.c +++ b/src/bb-copy-to.c @@ -15,7 +15,7 @@ #include "abt.h" #include "abt-snoozer.h" -#include "bake-bulk.h" +#include "bake-bulk-client.h" /* client program that will copy a POSIX file into a bake bulk region */ diff --git a/src/bb-latency-bench.c b/src/bb-latency-bench.c index fd53d2a..e1d8d78 100644 --- a/src/bb-latency-bench.c +++ b/src/bb-latency-bench.c @@ -15,7 +15,7 @@ #include "abt.h" #include "abt-snoozer.h" -#include "bake-bulk.h" +#include "bake-bulk-client.h" static void bench_routine_write(bake_target_id_t bti, int iterations, double* measurement_array, int size); static void bench_routine_read(bake_target_id_t bti, int iterations, double* measurement_array, int size); diff --git a/src/bb-shutdown.c b/src/bb-shutdown.c index 38020fb..e11e21c 100644 --- a/src/bb-shutdown.c +++ b/src/bb-shutdown.c @@ -10,7 +10,7 @@ #include "abt.h" #include "abt-snoozer.h" -#include "bake-bulk.h" +#include "bake-bulk-client.h" /* client program that will shut down a BAKE bulk server. */ -- 2.26.2