September 27, 2014
24-Sep-2014 17:13, Etienne пишет:
> It's finally here: https://github.com/etcimon/libasync
>
> We all know how event loops are the foundation of more popular libraries
> Qt and Nodejs.. we now have a natively compiling async library entirely
> written in D.
>
> This event library was tested on Win32, Linux x64, Mac OS x64, with DMD
> 2.066, offers the more low-level async objects: timers, file i/o, dns
> resolver, tcp, udp, listeners, signals (cross-thread), notifications
> (same thread), and more recently (and with great efforts for
> implementing with OS X / BSD) a directory watcher.
>

Awesome! Bookmarked for future ;)

-- 
Dmitry Olshansky
September 27, 2014
On 2014-09-27 12:25 AM, Adam Wilson wrote:
> You mentioned Botan. I already have a C++ => D Wrapper project going
> over here: https://github.com/ellipticbit/titanium
>
> I am working out a bug where the memory corrupts itself when passing
> data back to D but it works and most of the leg-work is done. And I am
> definitely open to pull-requests.

Your wrapper will probably have to wrap a new Botan. I decided to translate everything to D because I need the complete interface.

https://github.com/etcimon/botan
September 27, 2014
On Saturday, 27 September 2014 at 17:06:53 UTC, Etienne wrote:
> On 2014-09-27 12:25 AM, Adam Wilson wrote:
>> You mentioned Botan. I already have a C++ => D Wrapper project going
>> over here: https://github.com/ellipticbit/titanium
>>
>> I am working out a bug where the memory corrupts itself when passing
>> data back to D but it works and most of the leg-work is done. And I am
>> definitely open to pull-requests.
>
> Your wrapper will probably have to wrap a new Botan. I decided to translate everything to D because I need the complete interface.
>
> https://github.com/etcimon/botan

How long do you think that's going to take?  What do you plan to do about ongoing C++ patches added to the original C++ botan version?  Maybe developing something like Daniel Murphy's DDMD magicport for botan would save you some time from doing it all manually.
September 27, 2014
On 2014-09-27 2:07 PM, Joakim wrote:
> How long do you think that's going to take?  What do you plan to do
> about ongoing C++ patches added to the original C++ botan version?
> Maybe developing something like Daniel Murphy's DDMD magicport for botan
> would save you some time from doing it all manually.

I see it done in a week before the testing, search and replace does the trick for most of it, the longest part is merging the .h and .cpp files. The patches don't seem very frequent (last update was in april, mostly minor), but I can also apply those manually if necessary. However, I intend on branching off completely and maintaining it myself with new algorithms, a certificate factory and a better BER/DER serialization engine (I have an ASN1 library in the works as well).
September 27, 2014
On 2014-09-27 2:13 PM, Etienne wrote:
> engine (I have an ASN1 library in the works as well).

It's nearly finished, it will allow BER/DER serialization to take place from UDAs and native types at compile-time:

https://github.com/globecsys/asn1.d
June 28, 2015
On Saturday, 27 September 2014 at 18:21:18 UTC, Etienne wrote:
> On 2014-09-27 2:13 PM, Etienne wrote:
>> engine (I have an ASN1 library in the works as well).
>
> It's nearly finished, it will allow BER/DER serialization to take place from UDAs and native types at compile-time:
>
> https://github.com/globecsys/asn1.d

/// Usage: run() the object, start watching directories, receive an event in your handler,
/// read the changes by draining the buffer.

Could you show how to use it for monitoring FS?

I did
import libasync.watcher;

So now I need simply call run()? But how to pass folder path to it?


void main()
{
	bool run()
	{
		return 0;
	}

}


It's seems that I missing something...
June 28, 2015
On Sunday, 28 June 2015 at 15:09:25 UTC, Suliman wrote:
> On Saturday, 27 September 2014 at 18:21:18 UTC, Etienne wrote:
>> On 2014-09-27 2:13 PM, Etienne wrote:
>>> engine (I have an ASN1 library in the works as well).
>>
>> It's nearly finished, it will allow BER/DER serialization to take place from UDAs and native types at compile-time:
>>
>> https://github.com/globecsys/asn1.d
>
> /// Usage: run() the object, start watching directories, receive an event in your handler,
> /// read the changes by draining the buffer.
>
> Could you show how to use it for monitoring FS?
>
> I did
> import libasync.watcher;
>
> So now I need simply call run()? But how to pass folder path to it?
>
>
> void main()
> {
> 	bool run()
> 	{
> 		return 0;
> 	}
>
> }
>
>
> It's seems that I missing something...

You can see an example in libasync.tests
June 28, 2015
> You can see an example in libasync.tests

thanks! I have got few questions
g_cbCheck = new shared bool[19];
what does it do?

AsyncDirectoryWatcher g_watcher = new AsyncDirectoryWatcher(getThreadEventLoop());
Am I right understand that it's run new eventloop inside AsyncDirectoryWatcher function?


June 28, 2015
It's particularity of unit-test blocks, or why function are specified without return type like:

g_evl = getThreadEventLoop();


Also next code that I take from example after run absolutely do not do nothing:

void main()
{

	auto g_evl = getThreadEventLoop();
	auto g_cbCheck = new shared bool[19];

	auto g_watcher = new AsyncDirectoryWatcher(g_evl);
	g_watcher.run({
		DWChangeInfo[1] change;
		DWChangeInfo[] changeRef = change.ptr[0..1];
		while(g_watcher.readChanges(changeRef)){
			g_cbCheck[18] = true;
			writeln(change);
		}
	});
	g_watcher.watchDir(".");
	AsyncTimer tm = new AsyncTimer(g_evl);
	tm.duration(1.seconds).run({
		writeln("Creating directory ./hey");
		mkdir("./hey");
		assert(g_watcher.watchDir("./hey/"));
		tm.duration(1.seconds).run({
			writeln("Writing to ./hey/tmp.tmp for the first time");
			std.file.write("./hey/tmp.tmp", "some string");
			tm.duration(100.msecs).run({
				writeln("Removing ./hey/tmp.tmp");
				remove("./hey/tmp.tmp");
			});
		});
	});


}
June 28, 2015
On Sunday, 28 June 2015 at 16:32:24 UTC, Suliman wrote:
>> You can see an example in libasync.tests
>
> thanks! I have got few questions
> g_cbCheck = new shared bool[19];
> what does it do?
>
> AsyncDirectoryWatcher g_watcher = new AsyncDirectoryWatcher(getThreadEventLoop());
> Am I right understand that it's run new eventloop inside AsyncDirectoryWatcher function?

The g_cbCheck is specific to this unit test, everytime a callback succeeds it will set its index to true in the array.

The event loop must be passed to the async object because the watcher will register itself to it when it is run.

When you've registered your callback in the watcher and run it through the event loop, you have to run the event loop and events will be pushed to your callback