Skip to content

Commit 7d4d883

Browse files
committed
release 3.0.1.0
1 parent ff45e8d commit 7d4d883

File tree

176 files changed

+30765
-25519
lines changed

Some content is hidden

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

176 files changed

+30765
-25519
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
/.venv*/
88
/.vscode/
99
/.python-version
10-
*/__pycache__/*
10+
**/__pycache__/*

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2016-2023 DolphinDB, Inc.
1+
Copyright 2016-2024 DolphinDB, Inc.
22

33

44
Apache License

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ To use DolphinDB Python SDK, you'll need:
1010
- CPython: version 3.6 and newer
1111
- DolphinDB Server
1212
- Packages:
13-
- NumPy: version 1.18 and newer
13+
- NumPy: version 1.18 and newer, but earlier than 2.0
1414
- pandas: version 1.0.0 and newer, but not version 1.3.0
1515
- future
16+
- packaging
1617
- Extension Packages:
1718
- PyArrow: version 9.0.0 and newer
1819

core/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+
}

core/include/BatchTableWriter.h

Lines changed: 9 additions & 11 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,22 +16,17 @@
1416
#include <tuple>
1517
#include <cassert>
1618

17-
#ifdef _MSC_VER
18-
#define EXPORT_DECL _declspec(dllexport)
19-
#else
20-
#define EXPORT_DECL
21-
#endif
22-
23-
2419
namespace dolphindb{
25-
class EXPORT_DECL BatchTableWriter {
20+
21+
class DBConnection;
22+
class EXPORT_DECL BatchTableWriter {
2623
public:
2724
/**
2825
* If fail to connect to the specified DolphinDB server, this function throw an exception.
2926
*/
3027
BatchTableWriter(const std::string& hostName, int port, const std::string& userId, const std::string& password, bool acquireLock=true);
3128

32-
~BatchTableWriter();
29+
virtual ~BatchTableWriter();
3330

3431
BatchTableWriter(const BatchTableWriter&) = delete;
3532

@@ -76,6 +73,7 @@ class EXPORT_DECL BatchTableWriter {
7673
*/
7774
template<typename... Targs>
7875
void insert(const string& dbName, const string& tableName, Targs... Fargs){
76+
//RECORDTIME("BTW::insert");
7977
SmartPointer<DestTable> destTable;
8078
{
8179
RWLockGuard<RWLock> _(&rwLock, false, acquireLock_);

core/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;

core/include/Concurrent.h

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@
2525
#include <sys/syscall.h>
2626
#include <semaphore.h>
2727
#endif
28+
29+
#include "Exports.h"
2830
#include "SmartPointer.h"
2931

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

4134
class Thread;
@@ -109,17 +102,17 @@ class EXPORT_DECL RWLock{
109102
#endif
110103
};
111104

112-
class EXPORT_DECL RWSpinLock{
113-
public:
114-
RWSpinLock(){};
115-
~RWSpinLock(){};
116-
void acquireRead(){}
117-
void acquireWrite(){}
118-
void releaseRead(){}
119-
void releaseWrite(){}
120-
private:
105+
// class EXPORT_DECL RWSpinLock{
106+
// public:
107+
// RWSpinLock(){};
108+
// ~RWSpinLock(){};
109+
// void acquireRead(){}
110+
// void acquireWrite(){}
111+
// void releaseRead(){}
112+
// void releaseWrite(){}
113+
// private:
121114

122-
};
115+
// };
123116

124117
class EXPORT_DECL ConditionalVariable{
125118
public:
@@ -140,7 +133,7 @@ class EXPORT_DECL ConditionalVariable{
140133

141134

142135
template<class T>
143-
class LockGuard{
136+
class EXPORT_DECL LockGuard{
144137
public:
145138
LockGuard(T* res, bool acquireLock = true):res_(res){
146139
if(acquireLock)
@@ -182,7 +175,7 @@ class TryLockGuard{
182175
};
183176

184177
template<class T>
185-
class RWLockGuard{
178+
class EXPORT_DECL RWLockGuard{
186179
public:
187180
RWLockGuard(T* res, bool exclusive, bool acquireLock = true):res_(res), exclusive_(exclusive), acquireLock_(acquireLock){
188181
if(res != NULL && acquireLock_){
@@ -431,7 +424,7 @@ class SynchronizedQueue{
431424
return true;
432425
}
433426

434-
int size(){
427+
std::size_t size(){
435428
LockGuard<Mutex> guard(&mutex_);
436429
return items_.size();
437430
}
@@ -572,7 +565,7 @@ class BlockingQueue {
572565
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(1), size_(0), head_(0), tail_(0) {}
573566
explicit BlockingQueue(size_t maxItems, size_t batchSize)
574567
: buf_(new T[maxItems]), capacity_(maxItems), batchSize_(batchSize), size_(0), head_(0), tail_(0) {}
575-
int size(){
568+
std::size_t size(){
576569
LockGuard<Mutex> guard(&lock_);
577570
return size_;
578571
}
@@ -631,9 +624,9 @@ class BlockingQueue {
631624
}
632625
if(size_ == 0)
633626
return false;
634-
int n = std::min(batchSize_, size_);
627+
std::size_t n = std::min(batchSize_, size_);
635628
items.resize(n);
636-
for(int i = 0; i < n; i++){
629+
for(std::size_t i = 0; i < n; i++){
637630
items[i] = std::move(buf_[head_]);
638631
buf_[head_] = T();
639632
head_ = (head_ + 1) % capacity_;

0 commit comments

Comments
 (0)