Skip to content

Commit bf5b3b6

Browse files
release 300.0
1 parent 710e64e commit bf5b3b6

File tree

161 files changed

+13495
-25945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+13495
-25945
lines changed

.vscode/settings.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ MessageQueueSP points to a MessageQueue, where user can poll messages from the s
738738
###### Example
739739

740740
```c++
741-
auto queue = client.subscribe(host, port, tableName);
741+
auto queue = client.subscribe(host, port, handler, tableName);
742742
Message msg;
743743
while(true) {
744744
if(queue->poll(msg, 1000)) {

README_CN.md

Lines changed: 357 additions & 1010 deletions
Large diffs are not rendered by default.

include/AsynWorker.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#pragma once
2+
3+
#include "Concurrent.h"
4+
#include "DBConnectionPoolImpl.h"
5+
6+
namespace dolphindb {
7+
class DBConnection;
8+
class AsynWorker: public Runnable {
9+
public:
10+
using Task = DBConnectionPoolImpl::Task;
11+
AsynWorker(DBConnectionPoolImpl& pool, CountDownLatchSP latch, const SmartPointer<DBConnection>& conn,
12+
const SmartPointer<SynchronizedQueue<Task>>& queue, TaskStatusMgmt& status,
13+
const string& hostName, int port, const string& userId , const string& password)
14+
: pool_(pool), latch_(latch), conn_(conn), queue_(queue),taskStatus_(status),
15+
hostName_(hostName), port_(port), userId_(userId), password_(password){}
16+
protected:
17+
virtual void run();
18+
19+
private:
20+
DBConnectionPoolImpl& pool_;
21+
CountDownLatchSP latch_;
22+
SmartPointer<DBConnection> conn_;
23+
SmartPointer<SynchronizedQueue<Task>> queue_;
24+
TaskStatusMgmt& taskStatus_;
25+
const string hostName_;
26+
int port_;
27+
const string userId_;
28+
const string password_;
29+
};
30+
31+
}

include/BatchTableWriter.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef BATCHTABLEWRITER_H_
22
#define BATCHTABLEWRITER_H_
33

4+
#include "Exports.h"
45
#include "Concurrent.h"
5-
#include "DolphinDB.h"
6-
#include "Util.h"
76
#include "Types.h"
87
#include "Exceptions.h"
8+
#include "Constant.h"
9+
#include "Dictionary.h"
10+
#include "Table.h"
911
#include <unordered_map>
1012
#include <string>
1113
#include <vector>
@@ -14,26 +16,17 @@
1416
#include <tuple>
1517
#include <cassert>
1618

17-
#ifdef _MSC_VER
18-
#ifdef _DDBAPIDLL
19-
#define EXPORT_DECL _declspec(dllexport)
20-
#else
21-
#define EXPORT_DECL __declspec(dllimport)
22-
#endif
23-
#else
24-
#define EXPORT_DECL
25-
#endif
26-
2719
namespace dolphindb{
2820

29-
class EXPORT_DECL BatchTableWriter {
21+
class DBConnection;
22+
class EXPORT_DECL BatchTableWriter {
3023
public:
3124
/**
3225
* If fail to connect to the specified DolphinDB server, this function throw an exception.
3326
*/
3427
BatchTableWriter(const std::string& hostName, int port, const std::string& userId, const std::string& password, bool acquireLock=true);
3528

36-
~BatchTableWriter();
29+
virtual ~BatchTableWriter();
3730

3831
BatchTableWriter(const BatchTableWriter&) = delete;
3932

include/Compress.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
#include "Types.h"
66
#include "SysIO.h"
7-
#include "DolphinDB.h"
7+
#include "Vector.h"
8+
89
namespace dolphindb {
910

1011
class CompressEncoderDecoder;

include/Concurrent.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,10 @@
2424
#include <sys/syscall.h>
2525
#include <semaphore.h>
2626
#endif
27+
28+
#include "Exports.h"
2729
#include "SmartPointer.h"
2830

29-
#ifdef _MSC_VER
30-
#ifdef _DDBAPIDLL
31-
#define EXPORT_DECL _declspec(dllexport)
32-
#else
33-
#define EXPORT_DECL __declspec(dllimport)
34-
#endif
35-
#else
36-
#define EXPORT_DECL
37-
#endif
3831
namespace dolphindb {
3932

4033
class Thread;
@@ -139,7 +132,7 @@ class EXPORT_DECL ConditionalVariable{
139132

140133

141134
template<class T>
142-
class LockGuard{
135+
class EXPORT_DECL LockGuard{
143136
public:
144137
LockGuard(T* res, bool acquireLock = true):res_(res){
145138
if(acquireLock)
@@ -181,7 +174,7 @@ class TryLockGuard{
181174
};
182175

183176
template<class T>
184-
class RWLockGuard{
177+
class EXPORT_DECL RWLockGuard{
185178
public:
186179
RWLockGuard(T* res, bool exclusive, bool acquireLock = true):res_(res), exclusive_(exclusive), acquireLock_(acquireLock){
187180
if(res != NULL && acquireLock_){
@@ -429,7 +422,7 @@ class SynchronizedQueue{
429422
return true;
430423
}
431424

432-
int size(){
425+
std::size_t size(){
433426
LockGuard<Mutex> guard(&mutex_);
434427
return items_.size();
435428
}
@@ -570,7 +563,7 @@ class BlockingQueue {
570563
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(1), size_(0), head_(0), tail_(0) {}
571564
explicit BlockingQueue(size_t maxItems, size_t batchSize)
572565
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(batchSize), size_(0), head_(0), tail_(0) {}
573-
int size(){
566+
std::size_t size(){
574567
LockGuard<Mutex> guard(&lock_);
575568
return size_;
576569
}
@@ -629,9 +622,9 @@ class BlockingQueue {
629622
}
630623
if(size_ == 0)
631624
return false;
632-
int n = std::min(batchSize_, size_);
625+
std::size_t n = std::min(batchSize_, size_);
633626
items.resize(n);
634-
for(int i = 0; i < n; i++){
627+
for(std::size_t i = 0; i < n; i++){
635628
items[i] = std::move(buf_[head_]);
636629
buf_[head_] = T();
637630
head_ = (head_ + 1) % capacity_;

0 commit comments

Comments
 (0)