Commit c523fa6e authored by Greg Williams's avatar Greg Williams
Browse files

Merged in kinetic protocol 3.0 working branch to make it the active working branch going forward

parents aa02d4ed 88dfb8ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
[submodule "kinetic-protocol"]
	path = vendor/kinetic-protocol
	url = https://github.com/Seagate/kinetic-protocol.git
	branch = 2.0.6
	branch = 3.0.5
[submodule "socket99"]
	path = vendor/socket99
	url = https://github.com/silentbicycle/socket99.git
+0 −1
Original line number Diff line number Diff line
@@ -7,6 +7,5 @@ compiler:
  - gcc
install:
  - bundle install
  - bundle exec ruby ./config/travis_install.rb
script:
  - make all
+53 −18
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ OPTIMIZE = -O3
WARN = -Wall -Wextra -pedantic
CDEFS += -D_POSIX_C_SOURCE=1 -D_C99_SOURCE=1
CFLAGS += -std=c99 -fPIC -g $(WARN) $(CDEFS) $(OPTIMIZE)
LDFLAGS += -lm -l crypto -l ssl
LDFLAGS += -lm -l crypto -l ssl -l pthread

#===============================================================================
# Kinetic-C Library Build Support
@@ -25,6 +25,7 @@ LIB_DIR = ./src/lib
VENDOR = ./vendor
PROTOBUFC = $(VENDOR)/protobuf-c
SOCKET99 = $(VENDOR)/socket99
ZLOG = $(VENDOR)/zlog
VERSION_FILE = ./VERSION
VERSION = ${shell head -n1 $(VERSION_FILE)}

@@ -33,7 +34,7 @@ KINETIC_LIB = $(BIN_DIR)/lib$(KINETIC_LIB_NAME).a
LIB_INCS = -I$(LIB_DIR) -I$(PUB_INC) -I$(PROTOBUFC) -I$(VENDOR)
LIB_DEPS = $(PUB_INC)/kinetic_client.h $(PUB_INC)/byte_array.h $(PUB_INC)/kinetic_types.h $(LIB_DIR)/kinetic_connection.h $(LIB_DIR)/kinetic_hmac.h $(LIB_DIR)/kinetic_logger.h $(LIB_DIR)/kinetic_message.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_types_internal.h
# LIB_OBJ = $(patsubst %,$(OUT_DIR)/%,$(LIB_OBJS))
LIB_OBJS = $(OUT_DIR)/kinetic_allocator.o $(OUT_DIR)/kinetic_nbo.o $(OUT_DIR)/kinetic_operation.o $(OUT_DIR)/kinetic_pdu.o $(OUT_DIR)/kinetic_proto.o $(OUT_DIR)/kinetic_socket.o $(OUT_DIR)/kinetic_message.o $(OUT_DIR)/kinetic_logger.o $(OUT_DIR)/kinetic_hmac.o $(OUT_DIR)/kinetic_connection.o $(OUT_DIR)/kinetic_types.o $(OUT_DIR)/kinetic_types_internal.o $(OUT_DIR)/byte_array.o $(OUT_DIR)/kinetic_client.o $(OUT_DIR)/socket99.o $(OUT_DIR)/protobuf-c.o
LIB_OBJS = $(OUT_DIR)/kinetic_allocator.o $(OUT_DIR)/kinetic_nbo.o $(OUT_DIR)/kinetic_operation.o $(OUT_DIR)/kinetic_pdu.o $(OUT_DIR)/kinetic_proto.o $(OUT_DIR)/kinetic_socket.o $(OUT_DIR)/kinetic_message.o $(OUT_DIR)/kinetic_logger.o $(OUT_DIR)/kinetic_hmac.o $(OUT_DIR)/kinetic_connection.o $(OUT_DIR)/kinetic_types.o $(OUT_DIR)/kinetic_types_internal.o $(OUT_DIR)/byte_array.o $(OUT_DIR)/kinetic_client.o $(OUT_DIR)/socket99.o $(OUT_DIR)/protobuf-c.o $(OUT_DIR)/zlog.o
KINETIC_LIB_OTHER_DEPS = Makefile Rakefile $(VERSION_FILE)

default: $(KINETIC_LIB)
@@ -48,17 +49,10 @@ ci: uninstall all install
	@echo $(PROJECT) v$(VERSION) is in working order
	@echo

test: Rakefile $(LIB_OBJS)
	@echo
	@echo --------------------------------------------------------------------------------
	@echo Testing $(PROJECT)
	@echo --------------------------------------------------------------------------------
	bundle install
	bundle exec rake test_all

clean:
	bundle exec rake clobber
	rm -rf $(BIN_DIR)/* $(OUT_DIR)/*.o *.core
	git submodule update --init

.PHONY: clean

@@ -90,6 +84,8 @@ $(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)/zlog.o: $(ZLOG)/zlog.c $(ZLOG)/zlog.h $(ZLOG)/zlog-config.h
	$(CC) -c -o $@ $< $(CFLAGS) -I$(ZLOG)
$(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
@@ -98,6 +94,21 @@ $(OUT_DIR)/kinetic_client.o: $(LIB_DIR)/kinetic_client.c $(LIB_DEPS)
	$(CC) -c -o $@ $< $(CFLAGS) $(LIB_INCS)


#-------------------------------------------------------------------------------
# Test Support
#-------------------------------------------------------------------------------

test: Rakefile $(LIB_OBJS)
	@echo
	@echo --------------------------------------------------------------------------------
	@echo Testing $(PROJECT)
	@echo --------------------------------------------------------------------------------
	bundle install
	bundle exec rake test_all

JAVA_HOME ?= /usr
JAVA_BIN = $(JAVA_HOME)/bin/java


#-------------------------------------------------------------------------------
# Static and Dynamic Library Build Support
@@ -159,6 +170,28 @@ uninstall:
	$(RM) -f $(PREFIX)/include/protobuf-c.h


#===============================================================================
# Java Simulator Support
#===============================================================================

update_simulator:
	cd vendor/kinetic-java; mvn clean package; cd -
	cp vendor/kinetic-java/kinetic-simulator/target/*.jar vendor/kinetic-java-simulator/

start_simulator:
	./vendor/kinetic-simulator/startSimulator.sh &
	sleep 4

erase_simulator: start_simulator
	./vendor/kinetic-simulator/eraseSimulator.sh
	sleep 1

stop_simulator:
	./vendor/kinetic-simulator/stopSimulator.sh

.PHONY: start_simulator erase_simulator stop_simulator


#===============================================================================
# Test Utility Build Support
#===============================================================================
@@ -167,7 +200,7 @@ UTILITY = kinetic-c-util
UTIL_DIR = ./src/utility
UTIL_EXEC = $(BIN_DIR)/$(UTILITY)
UTIL_OBJ = $(OUT_DIR)/main.o
UTIL_LDFLAGS += -lm -l ssl $(KINETIC_LIB) -l crypto
UTIL_LDFLAGS += -lm -l ssl $(KINETIC_LIB) -l crypto -l pthread

$(UTIL_OBJ): $(UTIL_DIR)/main.c
	$(CC) -c -o $@ $< $(CFLAGS) -I$(PUB_INC) -I$(UTIL_DIR)
@@ -192,17 +225,19 @@ CLASSPATH = $(JAVA_HOME)/lib/tools.jar:$(SIM_JARS_PREFIX)-jar-with-dependencies.
SIM_RUNNER = com.seagate.kinetic.simulator.internal.SimulatorRunner
SIM_ADMIN = com.seagate.kinetic.admin.cli.KineticAdminCLI

run: $(UTIL_EXEC)
run: $(UTIL_EXEC) start_simulator
	@echo
	@echo --------------------------------------------------------------------------------
	@echo Running test utility: $(UTIL_EXEC)
	@echo --------------------------------------------------------------------------------
	@sleep 2
	exec java -classpath "$(CLASSPATH)" $(SIM_RUNNER) "$@" &
	@sleep 5
	exec java -classpath "$(CLASSPATH)" $(SIM_ADMIN) -setup -erase true
	$(UTIL_EXEC) noop put get delete
	exec pkill -f 'java.*kinetic-simulator'
	@echo
	$(UTIL_EXEC) noop
	exec $(UTIL_EXEC) put
	exec $(UTIL_EXEC) get
	exec $(UTIL_EXEC) delete
	exec $(UTIL_EXEC) put get delete
	@echo
	@echo Test Utility integration tests w/ kinetic-c lib passed!
	@echo
	@echo Stopping simulator...
	./vendor/kinetic-simulator/stopSimulator.sh
+16 −8
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ 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-client-utility`)](https://github.com/Seagate/kinetic-c/tree/master/src/utility), which builds and links against the installed `kinetic-c-client` static library.
[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-utility`)](https://github.com/Seagate/kinetic-c/tree/master/src/utility), which builds and links against the installed `kinetic-c-client` static library.

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.

@@ -19,20 +19,29 @@ Prerequisites
Getting Started
---------------
**Clone the repo**

    > git clone --recursive https://github.com/atomicobject/kinetic-c.git
    > cd kinetic-c
    > bundle install # ensure you have all RubyGems at the proper versions

**Update to the latest version (previously cloned)**

    > git pull
    > git submodule update --init # Ensure submodules are up to date
    > bundle install # Ensure you have all RubyGems at the proper versions

**Build and install static library**

    > make
    > sudo make install

**Clean and uninstall old versions**

    > make clean
    > sudo uninstall

**Build example utility and run tests against Kinetic Device simulator**

    > make all # this is what Travis-CI build does to ensure it all keeps working

API Documentation
@@ -54,21 +63,20 @@ In order to execute a given example, after building it, you must first do:

    > cd bin

You can then execute `kinetic-c-client-util` with a valid example name, optionally preceeded with any of the optional arguments.
You can then execute `kinetic-c-util` with a valid example name, which may be preceeded by any of the options noted.

Options
-------
* `--host [HostName/IP]` or `-h [HostName/IP]` - Set the Kinetic Device host
* `--tls` - Use the TLS port to execute the specified operation(s)

Operations
----------
* `kinetic-c-client [--host|-h hostname|123.253.253.23] noop put get`
    * `kinetic-c-client-util noop`
* `kinetic-c-util [--host|-h hostname|123.253.253.23] [noop] [put] [get] [delete]`
    * `kinetic-c-util noop`
        * Execute a NoOp (ping) operation to verify the Kinetic Device is ready
    * `kinetic-c-client-util put`
    * `kinetic-c-util put`
        * Execute a Put operation to store a key/value entry
    * `kinetic-c-client-util get`
    * `kinetic-c-util get`
        * Execute a Get operation to retrieve a key/value entry
    * `kinetic-c-client-util delete`
    * `kinetic-c-util delete`
        * Execute a Delete operation to destroy a key/value entry
+15 −11
Original line number Diff line number Diff line
@@ -3,12 +3,16 @@ require 'kinetic-ruby'
compiler = ENV.fetch('CC', 'gcc')
compiler_location = `which #{compiler}`.strip
compiler_info = `#{compiler} --version 2>&1`.strip
puts "" +
"Configuration:\n" +


task :report_toolchain do
  report_banner("Toolchain Configuration")
  report "" +
    "  compiler:\n" +
    "    location: #{compiler_location}\n" +
    "    info:\n" +
"      " + compiler_info.gsub(/\n/, "\n      ") + "\n\n"
    "      " + compiler_info.gsub(/\n/, "\n      ") + "\n"
end

KineticRuby::Rake::load_tasks
require 'ceedling'
@@ -60,12 +64,12 @@ task :proto => [PROTO_OUT] do

  report_banner "Building protobuf v2.5.0"
  cd PROTOBUF_CORE do
    execute_command "./configure --disable-shared; make; make check; make install"
    execute_command "./configure --disable-shared; make; make check; sudo make install"
  end

  report_banner "Building protobuf-c and installing protoc-c"
  cd PROTOBUF_C do
    execute_command "./autogen.sh && ./configure && make && make install"
    execute_command "./autogen.sh && ./configure && make && sudo make install"
    protoc_c = `which protoc-c`
    raise "Failed to find protoc-c utility" if protoc_c.strip.empty?
    versions = `protoc-c --version`
@@ -140,7 +144,7 @@ namespace :java_sim do
    java_sim_cleanup

    # Find the java simulator jar
    jars = Dir["vendor/kinetic-java/kinetic-simulator*.jar"]
    jars = Dir["vendor/kinetic-simulator/kinetic-simulator*.jar"]
    raise "No Kinetic Java simulator .jar files found!" if jars.empty?

    # Configure the classpath
@@ -166,7 +170,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 -setup -erase true"
    sh "\"#{JAVA_BIN}\" -classpath \"#{ENV['CLASSPATH']}\" com.seagate.kinetic.admin.cli.KineticAdminCLI -instanterase"
  end

  def java_sim_cleanup
@@ -368,7 +372,7 @@ namespace :tests do

end

task :test_all => ['tests:unit', 'tests:integration', 'tests:system']
task :test_all => ['report_toolchain', 'tests:unit', 'tests:integration', 'tests:system']

desc "Build all and run test utility"
task :all => ['test_all']
Loading