Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://help.github.com/articles/dealing-with-line-endings

# Set the default behavior, in case people don't have core.autocrlf set.
text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Build output
/libvoltdbcpp/
/libvoltdbcpp.a
/libvoltdbcpp.so
Expand All @@ -11,3 +12,19 @@
/.settings
*~
*.dSYM

# Visual Studio cruft
/windows/**/win32
/windows/**/x64
/third_party_libs/src/**/win32
/third_party_libs/src/**/x64
**/windows/**/*.opensdf
**/windows/**/*.sdf
**/windows/**/*.suo
**/windows/**/*.user
/odbc/

# Vim backup files
*~
*.swp

57 changes: 57 additions & 0 deletions README-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# VoltDB C++ Client for Windows

For now the VoltDB Windows C++ client is only built as a static library.

Prerequisites and environment setup
=========================================

- Visual Studio 2013 or better.

- Boost C++ Library 1.54 or better. Windows build was tested with Boost
C++ library 1.56 -http://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.tar.gz/download,
32 and 64 bit version of it. Following are steps that can be used to build Boost 32 and 64 bit locally

32 Bit version:
Switch to the directory location where boost libraries have been extracted.
Run following steps to build and install 32 bit version of Boost libraries.
1 - bootstrap.bat
2 - b2.exe --prefix=c:\Boost --libdir=c:\Boost\lib\i386 install

64 Bit version:
Switch to the directory location where boost libraries have been extracted.
Run following steps to build and install 64 bit version of Boost libraries.
1 - bootstrap.bat
2 - b2.exe --prefix=c:\Boost --libdir=c:\Boost\lib\x64 architecture=x86 address-model=64 install

Create the necessary BOOST environment variables for the VS project:
- "BOOST_INCLUDE" set to path where the include boost directory that contains all the header files.
For above installation, set the BOOST_INCLUDE to "C:\Boost\include\boost-1_56". If properly set,
"echo %BOOST_INCLUDE%" will output "C:\Boost\include\boost-1_56".

- "BOOST_LIB_32" set to path where the BOOST 32 libraries are located. For above installation,
set the BOOST_LIB_32 to "C:\Boost\lib\i386". If properly set, "echo %BOOST_LIB_32%" will output
"C:\Boost\lib\i386"

- "BOOST_LIB_64" set to path where the BOOST 64 libraries are located. For above installation,
the BOOST_LIB_64 will be "C:\Boost\lib\x64". If properly set, "echo %BOOST_LIB_64%" will output
for example "C:\Boost\lib\x64".


## Building from the command line

Use your "favorite" method for creating a command prompt window with the
necessary environment for running Visual Studio command line tools. Any of
the following methods will work.

* Run the Developer Command Prompt from the Start Menu for Visual Studio.
* Run an ordinary command prompt and invoke VC\vcvarsall.bat from under the VS installation folder.
* Use some other ad hoc method for permanently setting the user environment.

### Using the run.bat script.

The tools\run.bat script constructs the appropriate command line and can
provide usage help. Run it with no arguments to see the usage message.

```
Usage: run build|clean|rebuild debug|release win32|x64
```
2 changes: 1 addition & 1 deletion README.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ version of libevent - simply replace the libevent tarball.
Running the tests

The tests require CPPUnit. You can install cppunit on ubuntu with the
command: `apt get install libcppunit-dev`
command: `apt-get install libcppunit-dev`

Once you have built either version of the shared library you can build the
tests using the makefile in Tests and then run the Tests executable that is
Expand Down
5 changes: 4 additions & 1 deletion examples/AsyncHelloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#if !defined (__STDC_CONSTANT_MACROS)
#define __STDC_CONSTANT_MACROS
#endif
#if !defined (__STDC_LIMIT_MACROS)
#define __STDC_LIMIT_MACROS

#endif
#include <vector>
#include <boost/shared_ptr.hpp>
#include "Client.h"
Expand Down
4 changes: 4 additions & 0 deletions examples/HelloWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#include <vector>
#include <boost/shared_ptr.hpp>
Expand Down
19 changes: 18 additions & 1 deletion examples/Voter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#include <vector>
#include <string>
Expand All @@ -31,7 +35,9 @@
#include <stdio.h>
#include <time.h>
#include <algorithm>
#ifndef _MSC_VER
#include <sys/time.h>
#endif
#include <boost/shared_ptr.hpp>
#include "Client.h"
#include "Table.h"
Expand Down Expand Up @@ -61,12 +67,23 @@ int64_t numSPCalls;
int64_t minAllowedOutstanding;
int64_t maxAllowedOutstanding;

#ifdef _MSC_VER
int64_t millisec_time() {
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
ULARGE_INTEGER t;
t.HighPart = ft.dwHighDateTime;
t.LowPart = ft.dwLowDateTime;
return t.QuadPart / 10000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is t.QuadPart assigned is it a union?

Copy link
Author

@hhakimi53 hhakimi53 Jun 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a union.

}
#else
int64_t millisec_time() {
struct timeval tp;
int res = gettimeofday(&tp, NULL);
assert(res == 0);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
}
#endif

class VoterCallback : public voltdb::ProcedureCallback
{
Expand Down Expand Up @@ -242,7 +259,7 @@ int main(int argc, char* argv[])
if (totExecutionsLatency == 0)
totExecutionsLatency = 1;

float percentComplete = 100 * elapsedTimeMillis2 / runTimeMillis;
float percentComplete = static_cast<float> (100 * elapsedTimeMillis2) / runTimeMillis;
if (percentComplete > 100.)
percentComplete = 100.;

Expand Down
3 changes: 3 additions & 0 deletions include/ByteBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@
#ifndef VOLTDB_BYTEBUFFER_H
#define VOLTDB_BYTEBUFFER_H

#include "PlatformInterface.hpp"
#include <stdint.h>
#if !defined (_MSC_VER)
#include <arpa/inet.h>
#endif
#include <boost/shared_array.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_array.hpp>
Expand Down
8 changes: 7 additions & 1 deletion include/ClientImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

#ifndef VOLTDB_CLIENTIMPL_H_
#define VOLTDB_CLIENTIMPL_H_

#include "PlatformInterface.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an empty line before this.

#include <event2/event.h>
#include <event2/bufferevent.h>
#include <map>
#include <set>
#include <list>
#include <string>
#include "ProcedureCallback.hpp"
//#include "StatusListener.h"
#include "Client.h"
#include "Procedure.hpp"
#include <boost/atomic.hpp>
Expand Down Expand Up @@ -163,6 +164,7 @@ class ClientImpl {
*/
void createPendingConnection(const std::string &hostname, const unsigned short port, const int64_t time=0);
void erasePendingConnection(PendingConnection *);
bool createWakeupNotificationPipe();

/*
* Method for sinking messages.
Expand Down Expand Up @@ -204,7 +206,11 @@ class ClientImpl {
boost::atomic<size_t> m_pendingConnectionSize;
boost::mutex m_pendingConnectionLock;

#if defined (_MSC_VER)
evutil_socket_t m_wakeupPipe[2];
#else
int m_wakeupPipe[2];
#endif
boost::mutex m_wakeupPipeLock;

ClientLogger* m_pLogger;
Expand Down
2 changes: 1 addition & 1 deletion include/ClientLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ClientLogger {
* @brief Values that represent logging levels.
*/
enum CLIENT_LOG_LEVEL {
ERROR = 1,
ERR = 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change ERROR to ERR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not letting compile in Windows environment even though it's part of enum. Was complaining about the predefined ERROR in Windows environment, so changed name to ERR instead.

WARNING = 2,
INFO = 4,
DEBUG = 8,
Expand Down
2 changes: 1 addition & 1 deletion include/Column.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace voltdb {
class Column {
public:
Column() {}
Column(std::string name, WireType type) : m_name(name), m_type(type) {}
Column(const std::string& name, WireType type) : m_name(name), m_type(type) {}
Column(WireType type) : m_name(""), m_type(type) {}
std::string m_name;
WireType m_type;
Expand Down
2 changes: 2 additions & 0 deletions include/Decimal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
* ASM doesn't compile on 32-bit Ubuntu 10.04
*/
#if !defined _M_X64 && !defined __x86_64__
#ifndef TTMATH_NOASM
#define TTMATH_NOASM
#endif
#endif
#include "ttmath/ttmathint.h"
#include "Exception.hpp"
#include <sstream>
Expand Down
2 changes: 2 additions & 0 deletions include/ElasticHashinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

#include <string>

#include "PlatformInterface.hpp"
#include "TheHashinator.h"
#include "MurmurHash3.h"
#include "boost/scoped_array.hpp"
#include <map>

namespace voltdb {
Expand Down
Loading