huntlabs / hunt Goto Github PK
View Code? Open in Web Editor NEWA refined core library for D programming language. The module has concurrency / collections / event / io / logging / text / serialization and more.
License: Apache License 2.0
A refined core library for D programming language. The module has concurrency / collections / event / io / logging / text / serialization and more.
License: Apache License 2.0
When data length is larger than 8192 x 2, there is a problem. Tracing epool_wait and kqueue can only return 2, so there is a problem over 8192 x 2.
code:
string[int] users;
users[10001] = Brian;
users[10002] = Heromyth
if (users.hasKey(10001))
{
// OK
}
if (users.keyExists(10002))
{
// OK
}
On MacOS, There may be bugs in Radix tree.
import std.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import hunt.collection.Radix;
void main()
{
byte[] data = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
ubyte[] key = cast(ubyte[])"A key";
void *value = malloc(data.length + 4);
uint len = cast(uint)data.length;
memcpy(value, &len, 4);
memcpy(value + 4, data.ptr, data.length);
rax *r;
r = rax.New();
writeln("Insert: ", r.Insert(key, value));
void *read;
if (!r.find(key, read))
{
writeln("Not found.");
return;
}
memcpy(&len, read, 4);
data = new byte[len];
memcpy(data.ptr, read + 4, len);
writeln(data);
r.Remove(key);
rax.Free(r);
}
Using this code to test, run it several times, and you will get different results:
1:
Running ./hunttest_radix
Insert: 1
Not found.
2:
Running ./hunttest_radix
Insert: 1
[1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]
(Program does not exit, there is a dead cycle...)
3:
Running ./hunttest_radix
Insert: 1
[1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Program exited with code -11
4:
Running ./hunttest_radix
Insert: 1
[1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]
(Normal end as expected)
Radix has a problem that prevents hunt-framework from working properly.
onDataReceived -> onReceived
Mr zhang @Heromyth
code style like:
import hunt.logging;
class User
{
bool Add();
bool Delete();
}
function name can use [delete].
If inscribe.
Hi,
I get the impression that you have ported OpenJDK code in many places ... this has potential IP issues. Firstly you should probably retain the OpenJDK copyright - and that implies GPL plus Classpath exception. But please be aware of potential IP issues.
The concurrency libraries however can be based on Doug Lea's version which is in the public domain. I suggest breaking out the concurrency library so that it is not tainted by Oracle IP.
Regards
Hi @Heromyth :
hunt/source/hunt/io/TcpStream.d
Line 284 in 0551699
Sample code:
if (_writeQueue is null && !_isWritting)
{
// You don't need to change the code here
}
else
{
initializeWriteQueue();
write(new SocketStreamBuffer(data, handler));
}
void initializeWriteQueue()
{
if (_writeQueue is null)
{
_writeQueue = new WritingBufferQueue();
}
}
@Heromyth , we need update hunt library for benchmark?
Add hunt-database for PostgreSQL benchmark and test more? :)
hunt 1.0.0-rc.3: building configuration "library"...
C:\Users\Mark\AppData\Local\dub\packages\hunt-1.0.0-rc.3\hunt\source\hunt\event\selector\iocp.d(192,10): Error: cannot implicitly override base class method `hunt.event.core.Selector.dispose` with `hunt.event.selector.iocp.AbstractSelector.dispose`; add `override` attribute
C:\Users\Mark\AppData\Local\dub\packages\hunt-1.0.0-rc.3\hunt\source\hunt\event\EventLoop.d(38,19): Error: function `hunt.event.EventLoop.EventLoop.stop` does not override any function
C:\d\dmd2\windows\bin\dmd.exe failed with exit code 1.
~
and after adding the override
attribute:
hunt 1.0.0-rc.3: building configuration "library"...
C:\Users\Mark\AppData\Local\dub\packages\hunt-1.0.0-rc.3\hunt\source\hunt\event\EventLoopGroup.d(28,25): Error: cannot create instance of abstract class `EventLoop`
C:\Users\Mark\AppData\Local\dub\packages\hunt-1.0.0-rc.3\hunt\source\hunt\event\EventLoopGroup.d(28,25): function `int doSelect(long timeout)` is not implemented
C:\d\dmd2\windows\bin\dmd.exe failed with exit code 1.
Mr zhang @Heromyth
/*
* Hunt - A refined core library for D programming language.
*
* Copyright (C) 2018-2019 HuntLabs
*
* Website: https://www.huntlabs.net/
*
* Licensed under the Apache-2.0 License.
*
*/
Add validation to binding http's form and entity's module.
Hello,
Can't run example on OSX:
Performing "debug" build using /Library/D/dmd/bin/dmd for x86_64.
kiss 0.4.8+commit.3.g2f367e4: target for configuration "debug" is up to date.
tcp-client ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./tcp-client
2018-08-02 12:02:12 (2368576) [debug] this - Buffer size for read: 8192 - ../../source/kiss/event/socket/posix.d:87
2018-08-02 12:02:12 (2368576) [debug] socket - new socket fd: cast(socket_t)6 - ../../source/kiss/event/socket/common.d:150
2018-08-02 12:02:12 (2368576) [debug] onWrite - start to write - ../../source/kiss/net/TcpStream.d:248
2018-08-02 12:02:12 (2368576) [debug] onWrite - writting... - ../../source/kiss/net/TcpStream.d:253
2018-08-02 12:02:12 (2368576) [debug] tryWrite - actually sent bytes: -1 / 12 - ../../source/kiss/event/socket/posix.d:232
2018-08-02 12:02:12 (2368576) [warning] tryWrite - errno=32, message: Broken pipe - ../../source/kiss/event/socket/posix.d:241
2018-08-02 12:02:12 (2368576) [error] onWrite - Socket error on write: fd=6, message=Broken pipe - ../../source/kiss/net/TcpStream.d:277
2018-08-02 12:02:12 (2368576) [debug] close - channel closing... - ../../source/kiss/event/core.d:168
2018-08-02 12:02:12 (2368576) [warning] onClose - Some data has not been sent yet. - ../../source/kiss/net/TcpStream.d:219
The connection is closed!
2018-08-02 12:02:12 (2368576) [debug] close - channel closed... - ../../source/kiss/event/core.d:171
2018-08-02 12:02:12 (2368576) [warning] close - The watcher(fd=6) has already been closed - ../../source/kiss/event/core.d:175
core.exception.InvalidMemoryOperationError@src/core/exception.d(700): Invalid memory operation
----------------
Program exited with code 1
Use Caffeine or JCache API (JSR 107) api design.
D regex is slow ..
benchmarking page:
https://github.com/mariomka/regex-benchmark
It's have hunt.Byte
It seems that the KissTimer
in package kiss.util.timer
always runs every 1 second, regardless of the Duration
passed to the constructor.
I have tested on Windows 10 with the following program:
import std.datetime : StopWatch, seconds;
import std.stdio : writeln;
import kiss.event : EventLoop;
import kiss.util.timer : KissTimer;
EventLoop eventLoop = new EventLoop();
StopWatch watch = StopWatch();
watch.start();
KissTimer timer = new KissTimer(eventLoop, 10.seconds);
timer.onTick((Object sender){ writeln(watch.peek.msecs); });
timer.start();
eventLoop.run();
Is that necessary?
Is that possible?
java 8.x reconstracts the java.time module.
Improved ease of use.
In this line if watch
is null it's unable to access .handle
property
https://github.com/huntlabs/kiss/blob/master/source/kiss/event/selector/epoll.d#L143
I think it's must be reworked, but don't know how (it's warning or error? continue or break with failure?).
That the standard D Object.opEquals(Object)
and Object.toHash()
methods aren't const
is a historical source of problems. The Hunt framework has an opportunity to correct this in IObject
& AbstractObject
. toString
is another method that might make sense to force to be const
.
The error code is 122
and is thrown from https://github.com/huntlabs/hunt/blob/master/source/hunt/event/selector/iocp.d#L142
[warning] onWriteDone - _writeQueue is empty!
logged from https://github.com/huntlabs/hunt/blob/master/source/hunt/event/socket/iocp.d#L345
test.conf
server.addreses = 127.0.0.1:8080
server.addreses = 127.0.0.1:9090
D Code:
class ServerConf
{
string addresses[];
}
Should the Hunt library be split into components such as hunt-collection, hunt-time, hunt-concurrency, hunt-typology? Make sure the hunt core library is as lightweight as possible.
Hi @jasonwhite
I want port darg file to hunt.util.arg module.
In example highlights a problem: doesn't work if use 255.255.255.255 addr.
Will it be fixed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.