www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Announcing Mecca

reply Shachar Shemesh <shachar weka.io> writes:
Hello everybody,

I am very happy to announce that Mecca version 0.0.1 (sorry, no more 
zeros than that) is now officially available. You can get the source 
code at https://github.com/weka-io/mecca. The API documentation is at 
https://weka-io.github.com/mecca/docs.

Mecca is a run-time support library for fibers management, as well as a 
few useful containers and libraries.

At this point in time, a getting started tutorial is still not 
available. Instead, I will post this small program for an echo server. 
It should give you a hint what APIs to check out with the documentation, 
so you can expand your search:

import core.sys.posix.sys.socket;
import std.algorithm : move;
import std.functional : toDelegate;

import mecca.log;
import mecca.reactor;
import mecca.reactor.io.fd;
import mecca.reactor.io.signals;

enum EchoerPort = 31337;

int main()
{
     theReactor.setup();

     reactorSignal.registerHandler(OSSignal.SIGTERM, 
toDelegate(&termHandler));
     reactorSignal.registerHandler(OSSignal.SIGINT, 
toDelegate(&termHandler));

     theReactor.spawnFiber!listener();

     return theReactor.start();
}

void termHandler(ref const(signalfd_siginfo) siginfo) {
     // Signal handler, but any non-yielding operation is safe to call 
from here.
     theReactor.stop();
}

void listener() {
     auto listenSocket = ConnectedSocket.listen( SockAddrIPv4.any( 
EchoerPort ) );
     listenSocket.setSockOpt( SOL_SOCKET, SO_REUSEADDR, 1 );

     while( true ) {
         SockAddr clientAddress;
         auto clientSocket = listenSocket.accept(clientAddress);

         // The next line's toString is the only reason we can't annotate
         // listener as  nogc.
         INFO!"Received new connection from %s"(clientAddress.toString());
         theReactor.spawnFiber!echoClient( move(clientSocket) );
     }
}

void echoClient(ConnectedSocket sock)  nogc {
     ssize_t dataLength;
     do {
         char[4096] buffer;
         dataLength = sock.read(buffer);
         sock.write(buffer[0..dataLength]);
     } while( dataLength>0 );
}
May 03 2018
next sibling parent Laeeth Isharc <laeeth laeeth.com> writes:
On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote:
 Hello everybody,

 I am very happy to announce that Mecca version 0.0.1 (sorry, no 
 more zeros than that) is now officially available. You can get 
 the source code at https://github.com/weka-io/mecca. The API 
 documentation is at https://weka-io.github.com/mecca/docs.

 [...]
https://www.reddit.com/r/programming/comments/8gxrkg/wekaio_open_sources_mecca_dlang_library_for_nogc?sort=new
May 04 2018
prev sibling parent reply Mengu <mengukagan gmail.com> writes:
On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote:
 Hello everybody,

 I am very happy to announce that Mecca version 0.0.1 (sorry, no 
 more zeros than that) is now officially available. You can get 
 the source code at https://github.com/weka-io/mecca. The API 
 documentation is at https://weka-io.github.com/mecca/docs.

 [...]
why the name mecca?
May 05 2018
parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 5 May 2018 at 10:43:53 UTC, Mengu wrote:
 On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote:
 Hello everybody,

 I am very happy to announce that Mecca version 0.0.1 (sorry, 
 no more zeros than that) is now officially available. You can 
 get the source code at https://github.com/weka-io/mecca. The 
 API documentation is at https://weka-io.github.com/mecca/docs.

 [...]
why the name mecca?
Liran said in his closing keynote that they use a lot of internal codenames that rhyme with Weka.
May 05 2018
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 05/05/2018 04:09 AM, Joakim wrote:
 On Saturday, 5 May 2018 at 10:43:53 UTC, Mengu wrote:
 On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote:
 Hello everybody,

 I am very happy to announce that Mecca version 0.0.1 (sorry, no more 
 zeros than that) is now officially available. You can get the source 
 code at https://github.com/weka-io/mecca. The API documentation is at 
 https://weka-io.github.com/mecca/docs.

 [...]
why the name mecca?
Liran said in his closing keynote that they use a lot of internal codenames that rhyme with Weka.
Shachar further explained that they have internal tools and projects that all end with "eka" like teka. M was available, so they called it Meka, which sounded like an existing place so changed its name to Mecca. Ali
May 05 2018