Skip to content

Commit

Permalink
release 300.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphindb-jffu committed Apr 10, 2024
1 parent 710e64e commit bf5b3b6
Show file tree
Hide file tree
Showing 161 changed files with 13,495 additions and 25,945 deletions.
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ MessageQueueSP points to a MessageQueue, where user can poll messages from the s
###### Example

```c++
auto queue = client.subscribe(host, port, tableName);
auto queue = client.subscribe(host, port, handler, tableName);
Message msg;
while(true) {
if(queue->poll(msg, 1000)) {
Expand Down
1,367 changes: 357 additions & 1,010 deletions README_CN.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions include/AsynWorker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include "Concurrent.h"
#include "DBConnectionPoolImpl.h"

namespace dolphindb {
class DBConnection;
class AsynWorker: public Runnable {
public:
using Task = DBConnectionPoolImpl::Task;
AsynWorker(DBConnectionPoolImpl& pool, CountDownLatchSP latch, const SmartPointer<DBConnection>& conn,
const SmartPointer<SynchronizedQueue<Task>>& queue, TaskStatusMgmt& status,
const string& hostName, int port, const string& userId , const string& password)
: pool_(pool), latch_(latch), conn_(conn), queue_(queue),taskStatus_(status),
hostName_(hostName), port_(port), userId_(userId), password_(password){}
protected:
virtual void run();

private:
DBConnectionPoolImpl& pool_;
CountDownLatchSP latch_;
SmartPointer<DBConnection> conn_;
SmartPointer<SynchronizedQueue<Task>> queue_;
TaskStatusMgmt& taskStatus_;
const string hostName_;
int port_;
const string userId_;
const string password_;
};

}
21 changes: 7 additions & 14 deletions include/BatchTableWriter.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#ifndef BATCHTABLEWRITER_H_
#define BATCHTABLEWRITER_H_

#include "Exports.h"
#include "Concurrent.h"
#include "DolphinDB.h"
#include "Util.h"
#include "Types.h"
#include "Exceptions.h"
#include "Constant.h"
#include "Dictionary.h"
#include "Table.h"
#include <unordered_map>
#include <string>
#include <vector>
Expand All @@ -14,26 +16,17 @@
#include <tuple>
#include <cassert>

#ifdef _MSC_VER
#ifdef _DDBAPIDLL
#define EXPORT_DECL _declspec(dllexport)
#else
#define EXPORT_DECL __declspec(dllimport)
#endif
#else
#define EXPORT_DECL
#endif

namespace dolphindb{

class EXPORT_DECL BatchTableWriter {
class DBConnection;
class EXPORT_DECL BatchTableWriter {
public:
/**
* If fail to connect to the specified DolphinDB server, this function throw an exception.
*/
BatchTableWriter(const std::string& hostName, int port, const std::string& userId, const std::string& password, bool acquireLock=true);

~BatchTableWriter();
virtual ~BatchTableWriter();

BatchTableWriter(const BatchTableWriter&) = delete;

Expand Down
3 changes: 2 additions & 1 deletion include/Compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

#include "Types.h"
#include "SysIO.h"
#include "DolphinDB.h"
#include "Vector.h"

namespace dolphindb {

class CompressEncoderDecoder;
Expand Down
23 changes: 8 additions & 15 deletions include/Concurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@
#include <sys/syscall.h>
#include <semaphore.h>
#endif

#include "Exports.h"
#include "SmartPointer.h"

#ifdef _MSC_VER
#ifdef _DDBAPIDLL
#define EXPORT_DECL _declspec(dllexport)
#else
#define EXPORT_DECL __declspec(dllimport)
#endif
#else
#define EXPORT_DECL
#endif
namespace dolphindb {

class Thread;
Expand Down Expand Up @@ -139,7 +132,7 @@ class EXPORT_DECL ConditionalVariable{


template<class T>
class LockGuard{
class EXPORT_DECL LockGuard{
public:
LockGuard(T* res, bool acquireLock = true):res_(res){
if(acquireLock)
Expand Down Expand Up @@ -181,7 +174,7 @@ class TryLockGuard{
};

template<class T>
class RWLockGuard{
class EXPORT_DECL RWLockGuard{
public:
RWLockGuard(T* res, bool exclusive, bool acquireLock = true):res_(res), exclusive_(exclusive), acquireLock_(acquireLock){
if(res != NULL && acquireLock_){
Expand Down Expand Up @@ -429,7 +422,7 @@ class SynchronizedQueue{
return true;
}

int size(){
std::size_t size(){
LockGuard<Mutex> guard(&mutex_);
return items_.size();
}
Expand Down Expand Up @@ -570,7 +563,7 @@ class BlockingQueue {
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(1), size_(0), head_(0), tail_(0) {}
explicit BlockingQueue(size_t maxItems, size_t batchSize)
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(batchSize), size_(0), head_(0), tail_(0) {}
int size(){
std::size_t size(){
LockGuard<Mutex> guard(&lock_);
return size_;
}
Expand Down Expand Up @@ -629,9 +622,9 @@ class BlockingQueue {
}
if(size_ == 0)
return false;
int n = std::min(batchSize_, size_);
std::size_t n = std::min(batchSize_, size_);
items.resize(n);
for(int i = 0; i < n; i++){
for(std::size_t i = 0; i < n; i++){
items[i] = std::move(buf_[head_]);
buf_[head_] = T();
head_ = (head_ + 1) % capacity_;
Expand Down
Loading

0 comments on commit bf5b3b6

Please sign in to comment.