summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-08-28 13:14:45 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-08-28 13:14:45 +0200
commitd8b975f4e73ae940c0c0f9c8c6c7aac1199fee09 (patch)
treeba7d60c37433707e6f2afe2538c966f04f2a3e92 /src
parentd90b4071151e3752208d3a9d49fb50845f89ab1b (diff)
msg_store_t renamed to swap_t
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/pipe.cpp2
-rw-r--r--src/pipe.hpp4
-rw-r--r--src/swap.cpp (renamed from src/msg_store.cpp)30
-rw-r--r--src/swap.hpp (renamed from src/msg_store.hpp)28
5 files changed, 34 insertions, 34 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d7509dc..f15814f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,7 +76,6 @@ libzmq_la_SOURCES = \
lb.hpp \
likely.hpp \
msg_content.hpp \
- msg_store.hpp \
mutex.hpp \
named_session.hpp \
object.hpp \
@@ -105,6 +104,7 @@ libzmq_la_SOURCES = \
stdint.hpp \
streamer.hpp \
sub.hpp \
+ swap.hpp \
tcp_connecter.hpp \
tcp_listener.hpp \
tcp_socket.hpp \
@@ -138,7 +138,6 @@ libzmq_la_SOURCES = \
ip.cpp \
kqueue.cpp \
lb.cpp \
- msg_store.cpp \
named_session.cpp \
object.cpp \
options.cpp \
@@ -162,6 +161,7 @@ libzmq_la_SOURCES = \
socket_base.cpp \
streamer.cpp \
sub.cpp \
+ swap.cpp \
tcp_connecter.cpp \
tcp_listener.cpp \
tcp_socket.cpp \
diff --git a/src/pipe.cpp b/src/pipe.cpp
index de20392..0108d56 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -174,7 +174,7 @@ zmq::writer_t::writer_t (object_t *parent_, pipe_t *pipe_, reader_t *reader_,
// Open the swap file, if required.
if (swap_size_ > 0) {
- swap = new (std::nothrow) msg_store_t (swap_size_);
+ swap = new (std::nothrow) swap_t (swap_size_);
zmq_assert (swap);
int rc = swap->init ();
zmq_assert (rc == 0);
diff --git a/src/pipe.hpp b/src/pipe.hpp
index dee37a5..d85f9dc 100644
--- a/src/pipe.hpp
+++ b/src/pipe.hpp
@@ -25,7 +25,7 @@
#include "stdint.hpp"
#include "yarray_item.hpp"
#include "ypipe.hpp"
-#include "msg_store.hpp"
+#include "swap.hpp"
#include "config.hpp"
#include "object.hpp"
@@ -183,7 +183,7 @@ namespace zmq
// Pointer to the message swap. If NULL, messages are always
// kept in main memory.
- msg_store_t *swap;
+ swap_t *swap;
// Sink for the events (either the socket or the session).
i_writer_events *sink;
diff --git a/src/msg_store.cpp b/src/swap.cpp
index aaf6dbe..cf73576 100644
--- a/src/msg_store.cpp
+++ b/src/swap.cpp
@@ -35,11 +35,11 @@
#include <sstream>
#include <algorithm>
+#include "swap.hpp"
#include "atomic_counter.hpp"
-#include "msg_store.hpp"
#include "err.hpp"
-zmq::msg_store_t::msg_store_t (int64_t filesize_, size_t block_size_) :
+zmq::swap_t::swap_t (int64_t filesize_, size_t block_size_) :
fd (-1),
filesize (filesize_),
file_pos (0),
@@ -60,7 +60,7 @@ zmq::msg_store_t::msg_store_t (int64_t filesize_, size_t block_size_) :
read_buf = write_buf = buf1;
}
-zmq::msg_store_t::~msg_store_t ()
+zmq::swap_t::~swap_t ()
{
delete [] buf1;
delete [] buf2;
@@ -83,7 +83,7 @@ zmq::msg_store_t::~msg_store_t ()
errno_assert (rc == 0);
}
-int zmq::msg_store_t::init ()
+int zmq::swap_t::init ()
{
static zmq::atomic_counter_t seqnum (0);
@@ -116,7 +116,7 @@ int zmq::msg_store_t::init ()
return 0;
}
-bool zmq::msg_store_t::store (zmq_msg_t *msg_)
+bool zmq::swap_t::store (zmq_msg_t *msg_)
{
size_t msg_size = zmq_msg_size (msg_);
@@ -138,7 +138,7 @@ bool zmq::msg_store_t::store (zmq_msg_t *msg_)
return true;
}
-void zmq::msg_store_t::fetch (zmq_msg_t *msg_)
+void zmq::swap_t::fetch (zmq_msg_t *msg_)
{
// There must be at least one message available.
zmq_assert (read_pos != write_pos);
@@ -157,12 +157,12 @@ void zmq::msg_store_t::fetch (zmq_msg_t *msg_)
copy_from_file (zmq_msg_data (msg_), msg_size);
}
-void zmq::msg_store_t::commit ()
+void zmq::swap_t::commit ()
{
commit_pos = write_pos;
}
-void zmq::msg_store_t::rollback ()
+void zmq::swap_t::rollback ()
{
if (commit_pos == write_pos || read_pos == write_pos)
return;
@@ -183,17 +183,17 @@ void zmq::msg_store_t::rollback ()
write_pos = commit_pos;
}
-bool zmq::msg_store_t::empty ()
+bool zmq::swap_t::empty ()
{
return read_pos == write_pos;
}
-bool zmq::msg_store_t::full ()
+bool zmq::swap_t::full ()
{
return buffer_space () == 1;
}
-void zmq::msg_store_t::copy_from_file (void *buffer_, size_t count_)
+void zmq::swap_t::copy_from_file (void *buffer_, size_t count_)
{
char *dest_ptr = (char *) buffer_;
size_t chunk_size, remainder = count_;
@@ -217,7 +217,7 @@ void zmq::msg_store_t::copy_from_file (void *buffer_, size_t count_)
}
}
-void zmq::msg_store_t::copy_to_file (const void *buffer_, size_t count_)
+void zmq::swap_t::copy_to_file (const void *buffer_, size_t count_)
{
char *source_ptr = (char *) buffer_;
size_t chunk_size, remainder = count_;
@@ -246,7 +246,7 @@ void zmq::msg_store_t::copy_to_file (const void *buffer_, size_t count_)
}
}
-void zmq::msg_store_t::fill_buf (char *buf, int64_t pos)
+void zmq::swap_t::fill_buf (char *buf, int64_t pos)
{
if (file_pos != pos) {
#ifdef ZMQ_HAVE_WINDOWS
@@ -272,7 +272,7 @@ void zmq::msg_store_t::fill_buf (char *buf, int64_t pos)
file_pos += octets_total;
}
-void zmq::msg_store_t::save_write_buf ()
+void zmq::swap_t::save_write_buf ()
{
if (file_pos != write_buf_start_addr) {
#ifdef ZMQ_HAVE_WINDOWS
@@ -298,7 +298,7 @@ void zmq::msg_store_t::save_write_buf ()
file_pos += octets_total;
}
-int64_t zmq::msg_store_t::buffer_space ()
+int64_t zmq::swap_t::buffer_space ()
{
if (write_pos < read_pos)
return read_pos - write_pos;
diff --git a/src/msg_store.hpp b/src/swap.hpp
index 765fc60..c9dfd99 100644
--- a/src/msg_store.hpp
+++ b/src/swap.hpp
@@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MSG_STORE_HPP_INCLUDED__
-#define __ZMQ_MSG_STORE_HPP_INCLUDED__
+#ifndef __ZMQ_SWAP_HPP_INCLUDED__
+#define __ZMQ_SWAP_HPP_INCLUDED__
#include "../include/zmq.h"
@@ -28,38 +28,38 @@
namespace zmq
{
- // This class implements a message store. Messages are retrieved from
- // the store in the same order as they entered it.
+ // This class implements a message swap. Messages are retrieved from
+ // the swap in the same order as they entered it.
- class msg_store_t
+ class swap_t
{
public:
enum { default_block_size = 8192 };
- // Creates message store.
- msg_store_t (int64_t filesize_, size_t block_size_ = default_block_size);
+ // Creates the swap.
+ swap_t (int64_t filesize_, size_t block_size_ = default_block_size);
- ~msg_store_t ();
+ ~swap_t ();
int init ();
- // Stores the message into the message store. The function
- // returns false if the message store is full; true otherwise.
+ // Stores the message into the swap. The function
+ // returns false if the swap is full; true otherwise.
bool store (zmq_msg_t *msg_);
- // Fetches the oldest message from the message store. It is an error
- // to call this function when the message store is empty.
+ // Fetches the oldest message from the swap. It is an error
+ // to call this function when the swap is empty.
void fetch (zmq_msg_t *msg_);
void commit ();
void rollback ();
- // Returns true if the message store is empty; false otherwise.
+ // Returns true if the swap is empty; false otherwise.
bool empty ();
- // Returns true if and only if the store is full.
+ // Returns true if and only if the swap is full.
bool full ();
private: