Commit 958c82cc authored by Greg Williams's avatar Greg Williams
Browse files

Merge branch 'release/0.8.1'

parents 6ef0f60a 82ebffce
Loading
Loading
Loading
Loading
+31 −70
Original line number Diff line number Diff line
@@ -34,28 +34,9 @@ VERSION = ${shell head -n1 $(VERSION_FILE)}
KINETIC_LIB_NAME = $(PROJECT).$(VERSION)
KINETIC_LIB = $(BIN_DIR)/lib$(KINETIC_LIB_NAME).a
LIB_INCS = -I$(LIB_DIR) -I$(PUB_INC) -I$(PROTOBUFC) -I$(SOCKET99) -I$(VENDOR)
LIB_DEPS = \
	$(PROTOBUFC)/protobuf-c/protobuf-c.h \
	$(SOCKET99)/socket99.h \
	$(LIB_DIR)/kinetic_allocator.h \
	$(LIB_DIR)/kinetic_nbo.h \
	$(LIB_DIR)/kinetic_operation.h \
	$(LIB_DIR)/kinetic_pdu.h \
	$(LIB_DIR)/kinetic_proto.h \
	$(LIB_DIR)/kinetic_socket.h \
	$(LIB_DIR)/kinetic_message.h \
	$(LIB_DIR)/kinetic_logger.h \
	$(LIB_DIR)/kinetic_hmac.h \
	$(LIB_DIR)/kinetic_controller.h \
	$(LIB_DIR)/kinetic_device_info.h \
	$(LIB_DIR)/kinetic_serial_allocator.h \
	$(LIB_DIR)/kinetic_connection.h \
	$(LIB_DIR)/kinetic_types_internal.h \
	$(PUB_INC)/kinetic_types.h \
	$(PUB_INC)/byte_array.h \
	$(PUB_INC)/kinetic_client.h

# LIB_OBJ = $(patsubst %,$(OUT_DIR)/%,$(LIB_OBJS))

C_SRC=${LIB_DIR}/*.[ch] $(SOCKET99)/socket99.[ch] $(PROTOBUFC)/protobuf-c/protobuf-c.[ch]

LIB_OBJS = \
	$(OUT_DIR)/socket99.o \
	$(OUT_DIR)/protobuf-c.o \
@@ -76,6 +57,7 @@ LIB_OBJS = \
	$(OUT_DIR)/kinetic_types.o \
	$(OUT_DIR)/byte_array.o \
	$(OUT_DIR)/kinetic_client.o

KINETIC_LIB_OTHER_DEPS = Makefile Rakefile $(VERSION_FILE)

default: makedirs $(KINETIC_LIB)
@@ -83,7 +65,7 @@ default: makedirs $(KINETIC_LIB)
makedirs:
	@echo; mkdir -p ./bin/examples &> /dev/null; mkdir -p ./out &> /dev/null

all: clean test default run examples
all: default test run examples

clean: makedirs
	rm -rf ./bin/**/*
@@ -92,48 +74,28 @@ clean: makedirs
	git submodule update --init
	-./vendor/kinetic-simulator/stopSimulator.sh &> /dev/null;

.PHONY: clean
TAGS: ${C_SRC} Makefile
	@find . -name "*.[ch]" | grep -v vendor | grep -v build | xargs etags

.PHONY: clean run ci

${C_SRC}: Makefile

.POSIX:

# Source files should depend on corresponding .h, if present.
COMPILE_SOURCE=$(CC) -c -o $@ ${LIB_DIR}/$*.c $(CFLAGS) $(LIB_INCS)
${OUT_DIR}/%.o: ${LIB_DIR}/%.c ${LIB_DIR}/%.h ${PUB_INC}/*.h Makefile
	${COMPILE_SOURCE}
${OUT_DIR}/%.o: ${LIB_DIR}/%.c Makefile ${PUB_INC}/%.h Makefile
	${COMPILE_SOURCE}

# Sources with atypical paths / dependencies
$(OUT_DIR)/socket99.o: $(SOCKET99)/socket99.c $(SOCKET99)/socket99.h
	$(CC) -c -o $@ $< $(CFLAGS) -I$(SOCKET99)
$(OUT_DIR)/protobuf-c.o: $(PROTOBUFC)/protobuf-c/protobuf-c.c $(PROTOBUFC)/protobuf-c/protobuf-c.h
	$(CC) -c -o $@ $< -std=c99 -fPIC -g -Wall -Wno-unused-parameter $(OPTIMIZE) -I$(PROTOBUFC)
$(OUT_DIR)/kinetic_allocator.o: $(LIB_DIR)/kinetic_allocator.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_nbo.o: $(LIB_DIR)/kinetic_nbo.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_operation.o: $(LIB_DIR)/kinetic_operation.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_pdu.o: $(LIB_DIR)/kinetic_pdu.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_proto.o: $(LIB_DIR)/kinetic_proto.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_socket.o: $(LIB_DIR)/kinetic_socket.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_message.o: $(LIB_DIR)/kinetic_message.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_logger.o: $(LIB_DIR)/kinetic_logger.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_hmac.o: $(LIB_DIR)/kinetic_hmac.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_controller.o: $(LIB_DIR)/kinetic_controller.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_connection.o: $(LIB_DIR)/kinetic_connection.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_device_info.o: $(LIB_DIR)/kinetic_device_info.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_serial_allocator.o: $(LIB_DIR)/kinetic_serial_allocator.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_types_internal.o: $(LIB_DIR)/kinetic_types_internal.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_types.o: $(LIB_DIR)/kinetic_types.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/byte_array.o: $(LIB_DIR)/byte_array.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
$(OUT_DIR)/kinetic_client.o: $(LIB_DIR)/kinetic_client.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)
${OUT_DIR}/kinetic_types.o: ${LIB_DIR}/kinetic_types_internal.h


ci: uninstall all install
@@ -160,6 +122,8 @@ test: Rakefile $(LIB_OBJS)
JAVA_HOME ?= /usr
JAVA_BIN = $(JAVA_HOME)/bin/java

.PHONY: test


#-------------------------------------------------------------------------------
# Static and Dynamic Library Build Support
@@ -184,7 +148,6 @@ $(KINETIC_SO_DEV): $(LIB_OBJS) $(KINETIC_LIB_OTHER_DEPS)
	$(CC) -o $@ -shared $(LDFLAGS) $(LIB_OBJS)



#-------------------------------------------------------------------------------
# Installation Support
#-------------------------------------------------------------------------------
@@ -219,6 +182,8 @@ uninstall:
	$(RM) -f $(PREFIX)/include/protobuf-c/protobuf-c.h
	$(RM) -f $(PREFIX)/include/protobuf-c.h

.PHONY: install uninstall


#===============================================================================
# Java Simulator Support
@@ -229,18 +194,12 @@ update_simulator:
	cp vendor/kinetic-java/kinetic-simulator/target/*.jar vendor/kinetic-java-simulator/

start_simulator:
	@echo STARTING SIMULATOR...
	sleep 1
	./vendor/kinetic-simulator/startSimulator.sh &
	sleep 3
	@echo STARTED SIMULATOR!!!
	./vendor/kinetic-simulator/startSimulator.sh

stop_simulator:
	@echo STOPPING SIMULATOR...
	sleep 1
	./vendor/kinetic-simulator/stopSimulator.sh
	sleep 1
	@echo STOPPED SIMULATOR!!!

.PHONY: update_simulator start_simulator erase_simulator stop_simulator


#===============================================================================
@@ -267,6 +226,7 @@ utility: $(UTIL_EXEC)

build: $(KINETIC_LIB) $(KINETIC_SO_DEV) utility


#-------------------------------------------------------------------------------
# Support for Simulator and Exection of Test Utility
#-------------------------------------------------------------------------------
@@ -322,6 +282,7 @@ test_example_%: $(BIN_DIR)/examples/%
	$<
	@echo ================================================================================
	@echo
	./vendor/kinetic-simulator/stopSimulator.sh
test_example_%: start_simulator

run_example_%: $(BIN_DIR)/examples/%
+11 −3
Original line number Diff line number Diff line
@@ -3,9 +3,9 @@ Kinetic C Client Library
========================
The [Github kinetic-c Git repository](https://github.com/Seagate/kinetic-c) contains code for producing Kinetic C clients for interacting with Kinetic storage object-based storage. The library uses the cross-platform Seagate Kinetic protocol for standardizing interaces between the Java simulator and Kinetic Device storage clusters.

[Code examples](https://github.com/Seagate/kinetic-c/tree/master/src/utility/examples) are included for reference as part of the [kinetic-c client library test utility (`kinetic-c-util`)](https://github.com/Seagate/kinetic-c/tree/master/src/utility), which builds and links against the installed `kinetic-c-client` static library.
Reference code is included as part of the [kinetic-c client library test utility (`kinetic-c-util`)](src/utility), which builds and links against the installed `kinetic-c-client` static library. [Additional examples](src/examples) are included for the various types of I/O operations (e.g. blocking/non-blocking, single/multi-threaded). See below for more details.

The [project Makefile](https://github.com/Seagate/kinetic-c/blob/master/Makefile) can be used as a reference for developing a Makefile-based project for building for a custom Kinetic Storage C client driver and/or a high-level C library.
The [project Makefile](Makefile) can be used as a reference for developing a Makefile-based project for building for a custom Kinetic Storage C client driver and/or a high-level C library.

Kinetic Protocol Support
------------------------
@@ -59,7 +59,7 @@ API Documentation
    * The ByteArray and ByteBuffer types are used for exchanging variable length byte-arrays with kinetic-c
        * e.g. object keys, object value data, etc.

Example Client/Test Utility
Client Test Utility
===========================

Code examples are included for reference as part of a test utility. The source code for the utility is used to build both a static and dynamically linked verion of the kinetic-c-client library.
@@ -88,3 +88,11 @@ Operations
        * Execute a Delete operation to destroy a key/value entry
    * `./bin/kinetic-c-util instanterase`
        * Execute an InstantSecureErase operation to erase ALL content from the device

Kinetic C Client I/O Examples
=============================

* [`write_file_blocking`](src/examples/write_file_blocking.c) - Single thread, single connection, blocking operation.
* [`write_file_blocking_threads`](src/examples/write_file_blocking_threads.c) - Multiple threads, single connection, blocking operations.
* [`write_file_nonblocking`](src/examples/write_file_nonblocking.c) - Single thread, single connection, multiple non-blocking operations
* [`write_file_blocking_threads`](src/examples/write_file_blocking_threads.c) - Multiple threads, single connection, multiple non-blocking operations.
+16 −5
Original line number Diff line number Diff line
@@ -134,6 +134,10 @@ namespace :java_sim do
  JAVA_BIN = File.join(JAVA_HOME, 'bin/java')
  $java_sim = nil

  def kinetic_device_listening?
    `netstat -an` =~ /[\.:]8123.+\s+LISTEN\s+/
  end

  def java_sim_start

    return if $java_sim
@@ -150,10 +154,17 @@ namespace :java_sim do
    ENV['CLASSPATH'] = '' unless ENV['CLASSPATH']
    jars += [File.join(JAVA_HOME, 'lib/tools.jar')]
    jars.each {|jar| ENV['CLASSPATH'] += ':' + jar }
    $java_sim = spawn("#{JAVA_BIN} -classpath #{ENV['CLASSPATH']} com.seagate.kinetic.simulator.internal.SimulatorRunner") # &> ./build/kinetic-simulator.log") # &> ./build/kinetic-simulator-test.log")
    sleep 3 # wait for simulator to start up and server ready to receive connections
    # TODO: use netstat or something to just wait until the server opens the port
    #       since it might take longer than the hardcoded sleep(x) above :-/
    $java_sim = spawn("#{JAVA_BIN} -classpath #{ENV['CLASSPATH']} com.seagate.kinetic.simulator.internal.SimulatorRunner")
    max_wait_secs = 10
    sleep_duration = 0.2
    timeout = false
    elapsed_secs = 0
    while !kinetic_device_listening? && !timeout do
      sleep(sleep_duration)
      elapsed_secs += sleep_duration
      timeout = (elapsed_secs > max_wait_secs)
    end
    raise "Kinetic Java simulator failed to start within #{max_wait_secs} seconds!" if timeout
  end

  def java_sim_shutdown
@@ -169,7 +180,7 @@ namespace :java_sim do

  def java_sim_erase_drive
    java_sim_start
    sh "\"#{JAVA_BIN}\" -classpath \"#{ENV['CLASSPATH']}\" com.seagate.kinetic.admin.cli.KineticAdminCLI -instanterase" # &> ./build/kinetic-simulator-setup.log"
    sh "\"#{JAVA_BIN}\" -classpath \"#{ENV['CLASSPATH']}\" com.seagate.kinetic.admin.cli.KineticAdminCLI -instanterase"
  end

  def java_sim_cleanup
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ PROJECT_NAME = kinetic-c
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER           = "v0.8.1-beta"
PROJECT_NUMBER           = "v0.8.1"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+1 −1
Original line number Diff line number Diff line
0.8.1-beta
0.8.1
Loading