co v1.2.0
English
Changes
Bug fix
- fix #77
- fix #83
- Fix bug due to Coroutine in Copool not cleared inside the coroutine library.
- Fix assert bug in
disconnect()
oftcp::Client
.
coroutine
- Refactor coroutine library to simplify internal logic.
- Add unit test
unitest/co
for testing internal logic of coroutine schedulers.
support http
- Implement the
http::Server
class. - Implement the
http::Client
class. - Implement the
so::easy(...)
interface for quickly creating a static web server.
hash
- Add
size_t murmur_hash(...)
interface.
fastring
-
Support
std::hash<fastring>
, nowstd::unordered_map
can takefastring
as its key.std::unordered_map<fastring, fastring> um; LruMap<fastring, fastring> lm;
-
Added
lshift()
interface for left shifting the string.fastring s = "hello"; s.lshift(2); // s -> "llo"; s.lshift(8); // s -> "";
-
Added
shrink()
interface, similar toshrink_to_fit()
ofstd::string
, for reducing the capacity of fastring.fastring s(4096); // cap -> 4096 s.shrink(); // cap <4096
test/unitest
- Remove the
_test
suffix in the file name of the test/unitest code.
中文
Changes
Bug 修复
- fix #77
- fix #83
- 修复协程库内部 Copool 未清空 Coroutine 中旧数据引起的 bug.
- 修复 tcp::Client::disconnect() 中的 assert bug.
coroutine
- 重构协程库,简化内部逻辑
- 增加单元测试 unitest/co,用于测试 Scheduler 内部逻辑.
新增 http 模块
- 实现
http::Server
类. - 实现
http::Client
类. - 实现
so::easy(...)
接口,用于快速创建静态 web server.
hash
- 新增
size_t murmur_hash(...)
接口.
fastring
-
支持
std::hash<fastring>
,std::unordered_map
可以使用fastring
作为 key.std::unordered_map<fastring, fastring> um; LruMap<fastring, fastring> lm;
-
新增
lshift()
接口,将字符串左移若干字节.fastring s = "hello"; s.lshift(2); // s -> "llo"; s.lshift(8); // s -> "";
-
新增
shrink()
接口,与std::string
的shrink_to_fit()
类似,用于缩减 fastring 的容量.fastring s(4096); // cap -> 4096 s.shrink(); // cap < 4096
test/unitest
- 去掉 test/unitest 代码文件名中的
_test
后缀.