Rebrand Asyncdispatch2 to Chronos [WIP] (#20)

* Update file headers, copyright date

* Rename files and hopefully fix nimble

* Forgot to change path in tests

* Update readme
This commit is contained in:
Mamy Ratsimbazafy 2019-02-06 15:49:11 +01:00 committed by GitHub
parent 88933e8f1b
commit 9f15c6b752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 76 additions and 74 deletions

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 Status Research & Development GmbH
Copyright 2018-Present Status Research & Development GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2018 Status Research & Development GmbH
Copyright (c) 2018-Present Status Research & Development GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,11 +1,11 @@
# Asyncdispatch hard fork
# Chronos - The Efficient Asynchronous library
[![Build Status (Travis)](https://img.shields.io/travis/status-im/nim-asyncdispatch2/master.svg?label=Linux%20/%20macOS "Linux/macOS build status (Travis)")](https://travis-ci.org/status-im/nim-asyncdispatch2)
[![Windows build status (Appveyor)](https://img.shields.io/appveyor/ci/nimbus/nim-asyncdispatch2/master.svg?label=Windows "Windows build status (Appveyor)")](https://ci.appveyor.com/project/nimbus/nim-asyncdispatch2)
[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
## Core differences between asyncdispatch and asyncdispatch2
## Core differences between the standard library asyncdispatch and Chronos
1. Unified callback type `CallbackFunc`:
@ -40,7 +40,7 @@
3. Changed the behavior of OS descriptor event callbacks:
For some unknown reason, the current version of asyncdispatch uses seq[T] to hold a list of descriptor event listeners. However, in the asynchronous environment, there is no need for a list of event listeners. In asyncdispatch2, there is only one place for one READ listener and one place for one WRITE listener.
For some unknown reason, the current version of asyncdispatch uses seq[T] to hold a list of descriptor event listeners. However, in the asynchronous environment, there is no need for a list of event listeners. In Chronos, there is only one place for one READ listener and one place for one WRITE listener.
4. Removed the default timeout value for the poll() procedure, which allows incorrect usage of asyncdispatch and produces 500-ms timeouts in correct usage.
@ -53,7 +53,7 @@
* https://github.com/nim-lang/Nim/issues/6929
6. Asyncdispatch2 no longer uses `epochTime()`; instead, it uses the fastest time primitives for a specific OS, `fastEpochTime()`. Also, because MacOS supports only a millisecond resolution in `kqueue`, sub-millisecond resolution is not needed. For details, see https://github.com/nim-lang/Nim/issues/3909.
6. Chronos no longer uses `epochTime()`; instead, it uses the fastest time primitives for a specific OS, `fastEpochTime()`. Also, because MacOS supports only a millisecond resolution in `kqueue`, sub-millisecond resolution is not needed. For details, see https://github.com/nim-lang/Nim/issues/3909.
7. Removed all IO primitives (`recv()`, `recvFrom()`, `connect()`, `accept()`, `send()`, and `sendTo()`) from the public API, and moved all their functionality into Transports.
@ -70,13 +70,13 @@
13. Added cheap synchronization primitives: `AsyncLock`, `AsyncEvent`, and `AsyncQueue[T]`.
## Documentation
You can find more documentation, notes and examples in [Wiki](https://github.com/status-im/nim-asyncdispatch2/wiki).
You can find more documentation, notes and examples in [Wiki](https://github.com/status-im/nim-chronos/wiki).
## Installation
You can use Nim official package manager `nimble` to install `asyncdispatch2`. The most recent version of the library can be installed via:
You can use Nim official package manager `nimble` to install `chronos`. The most recent version of the library can be installed via:
```
$ nimble install https://github.com/status-im/nim-asyncdispatch2.git
$ nimble install https://github.com/status-im/nim-chronos.git
```
## TODO

View File

@ -1,11 +1,11 @@
# Asyncdispatch2
# (c) Copyright 2018
# Chronos
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
# Apache License, version 2.0, (LICENSE-APACHEv2)
# MIT license (LICENSE-MIT)
import asyncdispatch2/[asyncloop, asyncfutures2, asyncsync, handles, transport,
import chronos/[asyncloop, asyncfutures2, asyncsync, handles, transport,
timer]
export asyncloop, asyncfutures2, asyncsync, handles, transport, timer

View File

@ -1,9 +1,11 @@
packageName = "asyncdispatch2"
version = "2.1.6"
packageName = "chronos"
version = "2.2.0"
author = "Status Research & Development GmbH"
description = "Asyncdispatch2"
description = "Chronos"
license = "Apache License 2.0 or MIT"
skipDirs = @["tests", "Nim", "nim", "benchmarks"]
# workaround while chronos is still named asyncdispatch2 in Nimble
srcDir = "chronos"
# skipDirs = @["tests"]
### Dependencies

View File

@ -1,8 +1,8 @@
#
# Asyncdispatch2
# Chronos
#
# (c) Coprygith 2015 Dominik Picheta
# (c) Copyright 2018 Status Research & Development GmbH
# (c) Copyright 2015 Dominik Picheta
# (c) Copyright 2018-Present Status Research & Development GmbH
#
# Licensed under either of
# Apache License, version 2.0, (LICENSE-APACHEv2)

View File

@ -1,8 +1,8 @@
#
# Asyncdispatch2
# Chronos
#
# (c) Coprygith 2015 Dominik Picheta
# (c) Copyright 2018 Status Research & Development GmbH
# (c) Copyright 2015 Dominik Picheta
# (c) Copyright 2018-Present Status Research & Development GmbH
#
# Licensed under either of
# Apache License, version 2.0, (LICENSE-APACHEv2)

View File

@ -1,8 +1,8 @@
#
# Asyncdispatch2 synchronization primitives
# Chronos synchronization primitives
#
# (c) Coprygith 2018 Eugene Kabanov
# (c) Copyright 2018 Status Research & Development GmbH
# (c) Copyright 2018-Present Eugene Kabanov
# (c) Copyright 2018-Present Status Research & Development GmbH
#
# Licensed under either of
# Apache License, version 2.0, (LICENSE-APACHEv2)
@ -219,7 +219,7 @@ proc addLastNoWait*[T](aq: AsyncQueue[T], item: T) =
proc popFirstNoWait*[T](aq: AsyncQueue[T]): T =
## Get an item from the beginning of the queue ``aq`` immediately.
##
##
## If queue ``aq`` is empty, then ``AsyncQueueEmptyError`` exception raised.
var w: Future[void]
if aq.empty():
@ -231,7 +231,7 @@ proc popFirstNoWait*[T](aq: AsyncQueue[T]): T =
proc popLastNoWait*[T](aq: AsyncQueue[T]): T =
## Get an item from the end of the queue ``aq`` immediately.
##
##
## If queue ``aq`` is empty, then ``AsyncQueueEmptyError`` exception raised.
var w: Future[void]
if aq.empty():

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 Handles
# (c) Copyright 2018
# Chronos Handles
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 SendFile
# (c) Copyright 2018
# Chronos SendFile
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of

View File

@ -1,8 +1,8 @@
#
# Asyncdispatch2 Timer
# Chronos Timer
#
# (c) Coprygith 2017 Eugene Kabanov
# (c) Copyright 2018 Status Research & Development GmbH
# (c) Copyright 2017 Eugene Kabanov
# (c) Copyright 2018-Present Status Research & Development GmbH
#
# Licensed under either of
# Apache License, version 2.0, (LICENSE-APACHEv2)

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 Transport
# (c) Copyright 2018
# Chronos Transport
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 Transport Common Types
# (c) Copyright 2018
# Chronos Transport Common Types
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -352,7 +352,7 @@ proc toSAddr*(address: TransportAddress, sa: var Sockaddr_storage,
proc address*(ta: TransportAddress): IpAddress =
## Converts ``TransportAddress`` to ``net.IpAddress`` object.
##
##
## Note its impossible to convert ``TransportAddress`` of ``Unix`` family,
## because ``IpAddress`` supports only IPv4, IPv6 addresses.
if ta.family == AddressFamily.IPv4:
@ -453,7 +453,7 @@ proc resolveTAddress*(address: string, port: Port,
if family == IpAddressFamily.IPv4:
result = resolveTAddress(address, port, AddressFamily.IPv4)
elif family == IpAddressFamily.IPv6:
result = resolveTAddress(address, port, AddressFamily.IPv6)
result = resolveTAddress(address, port, AddressFamily.IPv6)
template checkClosed*(t: untyped) =
if (ReadClosed in (t).state) or (WriteClosed in (t).state):

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 Datagram Transport
# (c) Copyright 2018
# Chronos Datagram Transport
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of

View File

@ -1,6 +1,6 @@
#
# Asyncdispatch2 Stream Transport
# (c) Copyright 2018
# Chronos Stream Transport
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import strutils, unittest
import ../asyncdispatch2
import ../chronos
when isMainModule:
suite "TransportAddress test suite":

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest
import ../asyncdispatch2
import ../chronos
const HELLO_PORT = 45679
const TEST_MSG = "testmsg"

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import strutils, net, unittest
import ../asyncdispatch2
import ../chronos
const
TestsCount = 2000

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest
import ../asyncdispatch2
import ../chronos
proc testFuture1(): Future[int] {.async.} =
await sleepAsync(100)

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import strutils, unittest
import ../asyncdispatch2
import ../chronos
type
CustomServer = ref object of StreamServer

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest, strutils
import ../asyncdispatch2
import ../chronos
when not defined(windows):
import posix

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest
import ../asyncdispatch2
import ../chronos
const CallSoonTests = 10
var soonTest1 = 0'u

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import strutils, unittest, os
import ../asyncdispatch2
import ../chronos
when defined(windows):
import winlean

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest
import ../asyncdispatch2
import ../chronos
var testLockResult = ""
var testEventResult = ""

View File

@ -1,5 +1,5 @@
# Asyncdispatch2 Test Suite
# (c) Copyright 2018
# Chronos Test Suite
# (c) Copyright 2018-Present
# Status Research & Development GmbH
#
# Licensed under either of
@ -7,7 +7,7 @@
# MIT license (LICENSE-MIT)
import unittest
import ../asyncdispatch2, ../asyncdispatch2/timer
import ../chronos, ../chronos/timer
const TimersCount = 10