mirror of https://github.com/yandex/odyssey.git
flint: rename project
This commit is contained in:
parent
c71df38587
commit
3c9662b65b
|
@ -1,3 +1,3 @@
|
|||
**fluent**
|
||||
**flint**
|
||||
|
||||
Fiber networked engine library on top of libuv.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
|||
* performance done in one second.
|
||||
*/
|
||||
|
||||
#include <fluent.h>
|
||||
#include <flint.h>
|
||||
|
||||
static int csw = 0;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@
|
|||
* echo 0123456789 | nc -v 127.0.0.1 7778 # to test
|
||||
*/
|
||||
|
||||
#include <fluent.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
test_client(void *arg)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
CC = gcc
|
||||
RM = rm
|
||||
CFLAGS = -I. -Wall -g -O0 -I../lib
|
||||
LFLAGS = ../lib/libfluent.a -luv
|
||||
LFLAGS = ../lib/libflint.a -luv
|
||||
all: validate clean benchmark echo
|
||||
benchmark: benchmark.o
|
||||
$(CC) benchmark.o $(LFLAGS) -o benchmark
|
||||
echo: echo.o
|
||||
$(CC) echo.o $(LFLAGS) -o echo
|
||||
validate:
|
||||
@if [ ! -f ../lib/libfluent.a ]; then \
|
||||
@if [ ! -f ../lib/libflint.a ]; then \
|
||||
echo ""; \
|
||||
echo "Please build the library first."; \
|
||||
echo ""; \
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef FLINT_H_
|
||||
#define FLINT_H_
|
||||
|
||||
/*
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
# define FLINT_API __attribute__((visibility("default")))
|
||||
#else
|
||||
# define FLINT_API
|
||||
#endif
|
||||
|
||||
typedef void (*ftfunction_t)(void *arg);
|
||||
|
||||
typedef void* ft_t;
|
||||
typedef void* ftio_t;
|
||||
|
||||
FLINT_API ft_t
|
||||
ft_new(void);
|
||||
|
||||
FLINT_API int ft_free(ft_t);
|
||||
FLINT_API int ft_create(ft_t, ftfunction_t, void *arg);
|
||||
FLINT_API int ft_is_online(ft_t);
|
||||
FLINT_API void ft_start(ft_t);
|
||||
FLINT_API void ft_stop(ft_t);
|
||||
FLINT_API void ft_sleep(ft_t, uint64_t time_ms);
|
||||
|
||||
FLINT_API ftio_t
|
||||
ft_io_new(ft_t);
|
||||
|
||||
FLINT_API void ft_close(ftio_t);
|
||||
FLINT_API int ft_fd(ftio_t);
|
||||
FLINT_API int ft_is_connected(ftio_t);
|
||||
FLINT_API int ft_connect(ftio_t, char *addr, int port, uint64_t time_ms);
|
||||
FLINT_API int ft_connect_is_timeout(ftio_t);
|
||||
FLINT_API int ft_bind(ftio_t, char *addr, int port);
|
||||
FLINT_API int ft_accept(ftio_t, ftio_t *client);
|
||||
FLINT_API int ft_read(ftio_t, int size, uint64_t time_ms);
|
||||
FLINT_API int ft_read_is_timeout(ftio_t);
|
||||
FLINT_API char *ft_read_buf(ftio_t);
|
||||
FLINT_API int ft_write(ftio_t, char *buf, int size, uint64_t time_ms);
|
||||
FLINT_API int ft_write_is_timeout(ftio_t);
|
||||
|
||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_PRIVATE_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
51
lib/fluent.h
51
lib/fluent.h
|
@ -1,51 +0,0 @@
|
|||
#ifndef FLUENT_H_
|
||||
#define FLUENT_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
# define FLUENT_API __attribute__((visibility("default")))
|
||||
#else
|
||||
# define FLUENT_API
|
||||
#endif
|
||||
|
||||
typedef void (*ftfunction_t)(void *arg);
|
||||
|
||||
typedef void* ft_t;
|
||||
typedef void* ftio_t;
|
||||
|
||||
FLUENT_API ft_t
|
||||
ft_new(void);
|
||||
|
||||
FLUENT_API int ft_free(ft_t);
|
||||
FLUENT_API int ft_create(ft_t, ftfunction_t, void *arg);
|
||||
FLUENT_API int ft_is_online(ft_t);
|
||||
FLUENT_API void ft_start(ft_t);
|
||||
FLUENT_API void ft_stop(ft_t);
|
||||
FLUENT_API void ft_sleep(ft_t, uint64_t time_ms);
|
||||
|
||||
FLUENT_API ftio_t
|
||||
ft_io_new(ft_t);
|
||||
|
||||
FLUENT_API void ft_close(ftio_t);
|
||||
FLUENT_API int ft_fd(ftio_t);
|
||||
FLUENT_API int ft_is_connected(ftio_t);
|
||||
FLUENT_API int ft_connect(ftio_t, char *addr, int port, uint64_t time_ms);
|
||||
FLUENT_API int ft_connect_is_timeout(ftio_t);
|
||||
FLUENT_API int ft_bind(ftio_t, char *addr, int port);
|
||||
FLUENT_API int ft_accept(ftio_t, ftio_t *client);
|
||||
FLUENT_API int ft_read(ftio_t, int size, uint64_t time_ms);
|
||||
FLUENT_API int ft_read_is_timeout(ftio_t);
|
||||
FLUENT_API char *ft_read_buf(ftio_t);
|
||||
FLUENT_API int ft_write(ftio_t, char *buf, int size, uint64_t time_ms);
|
||||
FLUENT_API int ft_write_is_timeout(ftio_t);
|
||||
|
||||
#endif
|
20
lib/ft.c
20
lib/ft.c
|
@ -1,12 +1,12 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
ft_async_cb(uv_async_t *handle)
|
||||
|
@ -35,7 +35,7 @@ ft_close_cb(uv_handle_t *handle, void *arg)
|
|||
uv_close(handle, NULL);
|
||||
}
|
||||
|
||||
FLUENT_API ft_t
|
||||
FLINT_API ft_t
|
||||
ft_new(void)
|
||||
{
|
||||
ft *handle = malloc(sizeof(*handle));
|
||||
|
@ -51,7 +51,7 @@ ft_new(void)
|
|||
return (ft_t)handle;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_free(ft_t envp)
|
||||
{
|
||||
ft *env = envp;
|
||||
|
@ -69,7 +69,7 @@ ft_free(ft_t envp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_create(ft_t envp, ftfunction_t function, void *arg)
|
||||
{
|
||||
ft *env = envp;
|
||||
|
@ -83,14 +83,14 @@ ft_create(ft_t envp, ftfunction_t function, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_is_online(ft_t envp)
|
||||
{
|
||||
ft *env = envp;
|
||||
return env->online;
|
||||
}
|
||||
|
||||
FLUENT_API void
|
||||
FLINT_API void
|
||||
ft_start(ft_t envp)
|
||||
{
|
||||
ft *env = envp;
|
||||
|
@ -106,14 +106,14 @@ ft_start(ft_t envp)
|
|||
}
|
||||
}
|
||||
|
||||
FLUENT_API void
|
||||
FLINT_API void
|
||||
ft_stop(ft_t envp)
|
||||
{
|
||||
ft *env = envp;
|
||||
env->online = 0;
|
||||
}
|
||||
|
||||
FLUENT_API void
|
||||
FLINT_API void
|
||||
ft_sleep(ft_t envp, uint64_t time_ms)
|
||||
{
|
||||
ft *env = envp;
|
||||
|
|
2
lib/ft.h
2
lib/ft.h
|
@ -2,7 +2,7 @@
|
|||
#define FT_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_BUF_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <flint_private.h>
|
||||
|
||||
void
|
||||
ft_context_init_main(ftcontext *c)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_CONTEXT_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <flint_private.h>
|
||||
|
||||
void ft_fiber_init(ftfiber *fiber)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_FIBER_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
12
lib/ft_io.c
12
lib/ft_io.c
|
@ -1,14 +1,14 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
FLUENT_API ftio_t
|
||||
FLINT_API ftio_t
|
||||
ft_io_new(ft_t envp)
|
||||
{
|
||||
ft *env = envp;
|
||||
|
@ -52,7 +52,7 @@ ft_io_new(ft_t envp)
|
|||
return io;
|
||||
}
|
||||
|
||||
FLUENT_API void
|
||||
FLINT_API void
|
||||
ft_close(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
@ -75,7 +75,7 @@ ft_close(ftio_t iop)
|
|||
free(io);
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_fd(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_IO_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
ft_io_accept_cb(uv_stream_t *handle, int status)
|
||||
|
@ -37,7 +37,7 @@ ft_io_accept_client(ftio *io)
|
|||
return client;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_accept(ftio_t iop, ftio_t *client)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_bind(ftio_t iop, char *addr, int port)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
ft_io_connect_timeout_cb(uv_timer_t *handle)
|
||||
|
@ -32,14 +32,14 @@ wakeup:
|
|||
ft_wakeup(io->f, io->connect_fiber);
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_is_connected(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
return io->connected;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_connect(ftio_t iop, char *addr, int port, uint64_t time_ms)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
@ -93,7 +93,7 @@ ft_connect(ftio_t iop, char *addr, int port, uint64_t time_ms)
|
|||
return rc;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_connect_is_timeout(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
ft_io_read_timeout_cb(uv_timer_t *handle)
|
||||
|
@ -60,7 +60,7 @@ ft_io_read_cb(uv_stream_t *handle, ssize_t size, const uv_buf_t *buf)
|
|||
ft_wakeup(io->f, io->read_fiber);
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_read(ftio_t iop, int size, uint64_t time_ms)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
@ -88,14 +88,14 @@ ft_read(ftio_t iop, int size, uint64_t time_ms)
|
|||
return rc;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_read_is_timeout(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
return io->read_timeout;
|
||||
}
|
||||
|
||||
FLUENT_API char*
|
||||
FLINT_API char*
|
||||
ft_read_buf(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <fluent.h>
|
||||
#include <flint_private.h>
|
||||
#include <flint.h>
|
||||
|
||||
static void
|
||||
ft_io_write_timeout_cb(uv_timer_t *handle)
|
||||
|
@ -30,7 +30,7 @@ wakeup:
|
|||
ft_wakeup(io->f, io->write_fiber);
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_write(ftio_t iop, char *buf, int size, uint64_t time_ms)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
@ -56,7 +56,7 @@ ft_write(ftio_t iop, char *buf, int size, uint64_t time_ms)
|
|||
return rc;
|
||||
}
|
||||
|
||||
FLUENT_API int
|
||||
FLINT_API int
|
||||
ft_write_is_timeout(ftio_t iop)
|
||||
{
|
||||
ftio *io = iop;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_LIST_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_MACRO_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
||||
#include <fluent_private.h>
|
||||
#include <flint_private.h>
|
||||
|
||||
static void
|
||||
ft_scheduler_main(void *arg)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define FT_SCHEDULER_H_
|
||||
|
||||
/*
|
||||
* fluent.
|
||||
* flint.
|
||||
*
|
||||
* Cooperative multitasking engine.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# libfluent makefile.
|
||||
# libflint makefile.
|
||||
#
|
||||
CC = gcc
|
||||
AR = ar
|
||||
|
@ -15,7 +15,7 @@ OBJECTS = ft_context.o \
|
|||
ft_ioread.o \
|
||||
ft_iowrite.o
|
||||
|
||||
LIB = libfluent.a
|
||||
LIB = libflint.a
|
||||
$(LIB): clean $(OBJECTS)
|
||||
$(AR) cr $(LIB) $(OBJECTS)
|
||||
.c.o:
|
||||
|
|
Loading…
Reference in New Issue