mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-04-27 19:15:07 +00:00
Add and del ccnet compilation dependency in seafile (#347)
* Add and del ccnet compilation dependency in seafile * Del import ccnet * Del extra ccnet compilation dependencies * Del support WIN32
This commit is contained in:
parent
708bfacc86
commit
d50359c908
@ -190,7 +190,6 @@ def fetch_and_build():
|
||||
|
||||
libsearpc.compile_and_install()
|
||||
libevhtp.compile_and_install()
|
||||
ccnet.compile_and_install()
|
||||
seafile.compile_and_install()
|
||||
|
||||
|
||||
|
@ -50,16 +50,8 @@ class ServerCtl(object):
|
||||
self.init_seafile()
|
||||
|
||||
def init_ccnet(self):
|
||||
cmd = [
|
||||
'ccnet-init',
|
||||
'-F',
|
||||
self.central_conf_dir,
|
||||
'-c',
|
||||
self.ccnet_conf_dir,
|
||||
'--host',
|
||||
'test.seafile.com',
|
||||
]
|
||||
shell(cmd)
|
||||
os.mkdir (self.central_conf_dir, 0o755)
|
||||
os.mkdir (self.ccnet_conf_dir, 0o755)
|
||||
if self.db == 'mysql':
|
||||
self.add_ccnet_db_conf()
|
||||
else:
|
||||
|
@ -53,4 +53,6 @@
|
||||
#define ccnet_debug(fmt, ...) g_debug(fmt, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CONFIG_DIR "~/.ccnet"
|
||||
|
||||
#endif
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet/ccnet-object.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "seaf-db.h"
|
||||
#include "group-mgr.h"
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef SEAF_MQ_MANAGER_H
|
||||
#define SEAF_MQ_MANAGER_H
|
||||
|
||||
#include <jansson.h>
|
||||
|
||||
#define SEAFILE_SERVER_CHANNEL_EVENT "seaf_server.event"
|
||||
#define SEAFILE_SERVER_CHANNEL_STATS "seaf_server.stats"
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet/ccnet-object.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "seaf-db.h"
|
||||
#include "org-mgr.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <ccnet.h>
|
||||
#include "utils.h"
|
||||
|
||||
#include "seafile-session.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include "utils.h"
|
||||
|
||||
#include "seafile-session.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
|
||||
#define CCNET_TYPE_USER_MANAGER (ccnet_user_manager_get_type ())
|
||||
#define CCNET_USER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CCNET_TYPE_USER_MANAGER, CcnetUserManager))
|
||||
|
@ -189,7 +189,6 @@ AC_SUBST(LIB_ICONV)
|
||||
|
||||
LIBEVENT_REQUIRED=2.0
|
||||
GLIB_REQUIRED=2.16.0
|
||||
CCNET_REQUIRED=0.9.3
|
||||
SEARPC_REQUIRED=1.0
|
||||
JANSSON_REQUIRED=2.2.1
|
||||
ZDB_REQUIRED=2.10
|
||||
@ -210,10 +209,6 @@ PKG_CHECK_MODULES(GOBJECT, [gobject-2.0 >= $GLIB_REQUIRED])
|
||||
AC_SUBST(GOBJECT_CFLAGS)
|
||||
AC_SUBST(GOBJECT_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(CCNET, [libccnet >= $CCNET_REQUIRED])
|
||||
AC_SUBST(CCNET_CFLAGS)
|
||||
AC_SUBST(CCNET_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(SEARPC, [libsearpc >= $SEARPC_REQUIRED])
|
||||
AC_SUBST(SEARPC_CFLAGS)
|
||||
AC_SUBST(SEARPC_LIBS)
|
||||
|
@ -6,7 +6,6 @@ AM_CFLAGS = \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/common \
|
||||
@CCNET_CFLAGS@ \
|
||||
@SEARPC_CFLAGS@ \
|
||||
@GLIB2_CFLAGS@ \
|
||||
-Wall
|
||||
@ -15,7 +14,6 @@ noinst_HEADERS = seafile-controller.h ../common/log.h
|
||||
|
||||
seafile_controller_SOURCES = seafile-controller.c ../common/log.c
|
||||
|
||||
seafile_controller_LDADD = @CCNET_LIBS@ \
|
||||
$(top_builddir)/lib/libseafile_common.la \
|
||||
seafile_controller_LDADD = $(top_builddir)/lib/libseafile_common.la \
|
||||
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ @LIBEVENT_LIBS@ \
|
||||
@SEARPC_LIBS@ @JANSSON_LIBS@ @ZLIB_LIBS@
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <getopt.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
@ -44,10 +44,6 @@ struct _SeafileController {
|
||||
char *rpc_pipe_path;
|
||||
char *logdir;
|
||||
|
||||
CcnetClient *client;
|
||||
CcnetClient *sync_client;
|
||||
CcnetMqclientProc *mqclient_proc;
|
||||
|
||||
guint check_process_timer;
|
||||
guint client_io_id;
|
||||
/* Decide whether to start seaf-server in cloud mode */
|
||||
|
@ -5,7 +5,6 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/common \
|
||||
@CCNET_CFLAGS@ \
|
||||
@SEARPC_CFLAGS@ \
|
||||
@GLIB2_CFLAGS@ \
|
||||
@FUSE_CFLAGS@ \
|
||||
@ -39,8 +38,7 @@ seaf_fuse_SOURCES = seaf-fuse.c \
|
||||
../common/obj-backend-riak.c \
|
||||
../common/seafile-crypt.c
|
||||
|
||||
seaf_fuse_LDADD = @CCNET_LIBS@ \
|
||||
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ \
|
||||
seaf_fuse_LDADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ \
|
||||
-lsqlite3 @LIBEVENT_LIBS@ \
|
||||
$(top_builddir)/common/cdc/libcdc.la \
|
||||
@SEARPC_LIBS@ @JANSSON_LIBS@ @FUSE_LIBS@ @ZLIB_LIBS@ \
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <seaf-db.h>
|
||||
|
||||
#include "log.h"
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include <seaf-db.h>
|
||||
|
||||
#include "log.h"
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include <seaf-db.h>
|
||||
|
||||
#include "log.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "common.h"
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <seaf-db.h>
|
||||
|
||||
#include "log.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <utils.h>
|
||||
#include <locale.h>
|
||||
|
||||
|
@ -5,7 +5,6 @@ pkgconfigdir = $(libdir)/pkgconfig
|
||||
AM_CPPFLAGS = @GLIB2_CFLAGS@ -I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/common \
|
||||
@CCNET_CFLAGS@ \
|
||||
@SEARPC_CFLAGS@ \
|
||||
@MSVC_CFLAGS@ \
|
||||
-Wall
|
||||
@ -14,7 +13,7 @@ BUILT_SOURCES = gensource
|
||||
|
||||
## source file rules
|
||||
seafile_object_define = repo.vala commit.vala dirent.vala dir.vala \
|
||||
task.vala branch.vala crypt.vala webaccess.vala copy-task.vala
|
||||
task.vala branch.vala crypt.vala webaccess.vala copy-task.vala ccnetobj.vala
|
||||
|
||||
seafile_object_gen = $(seafile_object_define:.vala=.c)
|
||||
|
||||
@ -22,7 +21,7 @@ valac_gen = ${seafile_object_gen} seafile-object.h
|
||||
|
||||
EXTRA_DIST = ${seafile_object_define} rpc_table.py $(pcfiles) vala.stamp
|
||||
|
||||
utils_headers = net.h bloom-filter.h utils.h db.h
|
||||
utils_headers = net.h bloom-filter.h utils.h db.h job-mgr.h timer.h
|
||||
|
||||
utils_srcs = $(utils_headers:.h=.c)
|
||||
|
||||
|
49
lib/ccnetobj.vala
Normal file
49
lib/ccnetobj.vala
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
|
||||
namespace Ccnet {
|
||||
|
||||
|
||||
public class EmailUser : Object {
|
||||
|
||||
public int id { get; set; }
|
||||
public string email { get; set; }
|
||||
public bool is_staff { get; set; }
|
||||
public bool is_active { get; set; }
|
||||
public int64 ctime { get; set; }
|
||||
public string source { get; set; }
|
||||
public string role { get; set; }
|
||||
public string password { get; set; }
|
||||
public string reference_id { get; set; }
|
||||
}
|
||||
|
||||
public class Group : Object {
|
||||
|
||||
public int id { get; set; }
|
||||
public string group_name { get; set; }
|
||||
public string creator_name { get; set; }
|
||||
public int64 timestamp { get; set; }
|
||||
public string source { get; set; }
|
||||
public int parent_group_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class GroupUser : Object {
|
||||
|
||||
public int group_id { get; set; }
|
||||
public string user_name { get; set; }
|
||||
public int is_staff { get; set; }
|
||||
}
|
||||
|
||||
public class Organization : Object {
|
||||
|
||||
public int org_id { get; set; }
|
||||
public string email { get; set; }
|
||||
public int is_staff { get; set; }
|
||||
public string org_name { get; set; }
|
||||
public string url_prefix { get; set; }
|
||||
public string creator { get; set; }
|
||||
public int64 ctime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
@ -9,7 +9,6 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include <ccnet/valid-check.h>
|
||||
|
||||
#ifndef ccnet_warning
|
||||
#define ccnet_warning(fmt, ...) g_warning( "%s: " fmt, __func__ , ##__VA_ARGS__)
|
||||
|
167
lib/job-mgr.c
Normal file
167
lib/job-mgr.c
Normal file
@ -0,0 +1,167 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <event2/event.h>
|
||||
#include <event2/event_compat.h>
|
||||
#else
|
||||
#include <event.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define MAX_THREADS 50
|
||||
#define MAX_IDLE_THREADS 10
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include "job-mgr.h"
|
||||
|
||||
struct _CcnetJob {
|
||||
CcnetJobManager *manager;
|
||||
|
||||
int id;
|
||||
ccnet_pipe_t pipefd[2];
|
||||
|
||||
JobThreadFunc thread_func;
|
||||
JobDoneCallback done_func; /* called when the thread is done */
|
||||
void *data;
|
||||
|
||||
/* the done callback should only access this field */
|
||||
void *result;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
ccnet_job_manager_remove_job (CcnetJobManager *mgr, int job_id);
|
||||
|
||||
static void
|
||||
job_thread_wrapper (void *vdata, void *unused)
|
||||
{
|
||||
CcnetJob *job = vdata;
|
||||
|
||||
|
||||
job->result = job->thread_func (job->data);
|
||||
if (pipewriten (job->pipefd[1], "a", 1) != 1) {
|
||||
g_warning ("[Job Manager] write to pipe error: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
job_done_cb (evutil_socket_t fd, short event, void *vdata)
|
||||
{
|
||||
CcnetJob *job = vdata;
|
||||
char buf[1];
|
||||
|
||||
if (pipereadn (job->pipefd[0], buf, 1) != 1) {
|
||||
g_warning ("[Job Manager] read pipe error: %s\n", strerror(errno));
|
||||
}
|
||||
pipeclose (job->pipefd[0]);
|
||||
pipeclose (job->pipefd[1]);
|
||||
if (job->done_func) {
|
||||
job->done_func (job->result);
|
||||
}
|
||||
|
||||
ccnet_job_manager_remove_job (job->manager, job->id);
|
||||
}
|
||||
|
||||
int
|
||||
job_thread_create (CcnetJob *job)
|
||||
{
|
||||
if (ccnet_pipe (job->pipefd) < 0) {
|
||||
g_warning ("pipe error: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_thread_pool_push (job->manager->thread_pool, job, NULL);
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
event_once (job->pipefd[0], EV_READ, job_done_cb, job, NULL);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
CcnetJob *
|
||||
ccnet_job_new ()
|
||||
{
|
||||
CcnetJob *job;
|
||||
|
||||
job = g_new0 (CcnetJob, 1);
|
||||
return job;
|
||||
}
|
||||
|
||||
void
|
||||
ccnet_job_free (CcnetJob *job)
|
||||
{
|
||||
g_free (job);
|
||||
}
|
||||
|
||||
CcnetJobManager *
|
||||
ccnet_job_manager_new (int max_threads)
|
||||
{
|
||||
CcnetJobManager *mgr;
|
||||
|
||||
mgr = g_new0 (CcnetJobManager, 1);
|
||||
mgr->jobs = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL, (GDestroyNotify)ccnet_job_free);
|
||||
mgr->thread_pool = g_thread_pool_new (job_thread_wrapper,
|
||||
NULL,
|
||||
max_threads,
|
||||
FALSE,
|
||||
NULL);
|
||||
/* g_thread_pool_set_max_unused_threads (MAX_IDLE_THREADS); */
|
||||
|
||||
return mgr;
|
||||
}
|
||||
|
||||
void
|
||||
ccnet_job_manager_free (CcnetJobManager *mgr)
|
||||
{
|
||||
g_hash_table_destroy (mgr->jobs);
|
||||
g_thread_pool_free (mgr->thread_pool, TRUE, FALSE);
|
||||
g_free (mgr);
|
||||
}
|
||||
|
||||
int
|
||||
ccnet_job_manager_schedule_job (CcnetJobManager *mgr,
|
||||
JobThreadFunc func,
|
||||
JobDoneCallback done_func,
|
||||
void *data)
|
||||
{
|
||||
CcnetJob *job = ccnet_job_new ();
|
||||
job->id = mgr->next_job_id++;
|
||||
job->manager = mgr;
|
||||
job->thread_func = func;
|
||||
job->done_func = done_func;
|
||||
job->data = data;
|
||||
|
||||
g_hash_table_insert (mgr->jobs, (gpointer)(long)job->id, job);
|
||||
|
||||
if (job_thread_create (job) < 0) {
|
||||
g_hash_table_remove (mgr->jobs, (gpointer)(long)job->id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return job->id;
|
||||
}
|
||||
|
||||
void
|
||||
ccnet_job_manager_remove_job (CcnetJobManager *mgr, int job_id)
|
||||
{
|
||||
g_hash_table_remove (mgr->jobs, (gpointer)(long)job_id);
|
||||
}
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
void
|
||||
ccnet_job_manager_wait_job (CcnetJobManager *mgr, int job_id)
|
||||
{
|
||||
CcnetJob *job;
|
||||
|
||||
job = g_hash_table_lookup (mgr->jobs, (gpointer)(long)job_id);
|
||||
/* manually call job_done_cb */
|
||||
job_done_cb (0, 0, (void *)job);
|
||||
}
|
||||
#endif
|
57
lib/job-mgr.h
Normal file
57
lib/job-mgr.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
/**
|
||||
* Job Manager manages long term jobs. These jobs are run in their
|
||||
* own threads.
|
||||
*/
|
||||
|
||||
#ifndef JOB_MGR_H
|
||||
#define JOB_MGR_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct _CcnetSession;
|
||||
|
||||
typedef struct _CcnetJob CcnetJob;
|
||||
typedef struct _CcnetJobManager CcnetJobManager;
|
||||
|
||||
/*
|
||||
The thread func should return the result back by
|
||||
return (void *)result;
|
||||
The result will be passed to JobDoneCallback.
|
||||
*/
|
||||
typedef void* (*JobThreadFunc)(void *data);
|
||||
typedef void (*JobDoneCallback)(void *result);
|
||||
|
||||
|
||||
struct _CcnetJobManager {
|
||||
GHashTable *jobs;
|
||||
|
||||
GThreadPool *thread_pool;
|
||||
|
||||
int next_job_id;
|
||||
};
|
||||
|
||||
void
|
||||
ccnet_job_cancel (CcnetJob *job);
|
||||
|
||||
CcnetJobManager *
|
||||
ccnet_job_manager_new (int max_threads);
|
||||
|
||||
void
|
||||
ccnet_job_manager_free (CcnetJobManager *mgr);
|
||||
|
||||
int
|
||||
ccnet_job_manager_schedule_job (CcnetJobManager *mgr,
|
||||
JobThreadFunc func,
|
||||
JobDoneCallback done_func,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* Wait a specific job to be done.
|
||||
*/
|
||||
void
|
||||
ccnet_job_manager_wait_job (CcnetJobManager *mgr, int job_id);
|
||||
|
||||
|
||||
#endif
|
76
lib/timer.c
Normal file
76
lib/timer.c
Normal file
@ -0,0 +1,76 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <event2/event.h>
|
||||
#include <event2/event_compat.h>
|
||||
#include <event2/event_struct.h>
|
||||
#else
|
||||
#include <event.h>
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
struct CcnetTimer
|
||||
{
|
||||
struct event event;
|
||||
struct timeval tv;
|
||||
TimerCB func;
|
||||
void *user_data;
|
||||
uint8_t inCallback;
|
||||
};
|
||||
|
||||
static void
|
||||
timer_callback (evutil_socket_t fd, short event, void *vtimer)
|
||||
{
|
||||
int more;
|
||||
struct CcnetTimer *timer = vtimer;
|
||||
|
||||
timer->inCallback = 1;
|
||||
more = (*timer->func) (timer->user_data);
|
||||
timer->inCallback = 0;
|
||||
|
||||
if (more)
|
||||
evtimer_add (&timer->event, &timer->tv);
|
||||
else
|
||||
ccnet_timer_free (&timer);
|
||||
}
|
||||
|
||||
void
|
||||
ccnet_timer_free (CcnetTimer **ptimer)
|
||||
{
|
||||
CcnetTimer *timer;
|
||||
|
||||
/* zero out the argument passed in */
|
||||
g_return_if_fail (ptimer);
|
||||
|
||||
timer = *ptimer;
|
||||
*ptimer = NULL;
|
||||
|
||||
/* destroy the timer directly or via the command queue */
|
||||
if (timer && !timer->inCallback)
|
||||
{
|
||||
event_del (&timer->event);
|
||||
g_free (timer);
|
||||
}
|
||||
}
|
||||
|
||||
CcnetTimer*
|
||||
ccnet_timer_new (TimerCB func,
|
||||
void *user_data,
|
||||
uint64_t interval_milliseconds)
|
||||
{
|
||||
CcnetTimer *timer = g_new0 (CcnetTimer, 1);
|
||||
|
||||
timer->tv = timeval_from_msec (interval_milliseconds);
|
||||
timer->func = func;
|
||||
timer->user_data = user_data;
|
||||
|
||||
evtimer_set (&timer->event, timer_callback, timer);
|
||||
evtimer_add (&timer->event, &timer->tv);
|
||||
|
||||
return timer;
|
||||
}
|
28
lib/timer.h
Normal file
28
lib/timer.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef CCNET_TIMER_H
|
||||
#define CCNET_TIMER_H
|
||||
|
||||
/* return TRUE to reschedule the timer, return FALSE to cancle the timer */
|
||||
typedef int (*TimerCB) (void *data);
|
||||
|
||||
struct CcnetTimer;
|
||||
|
||||
typedef struct CcnetTimer CcnetTimer;
|
||||
|
||||
/**
|
||||
* Calls timer_func(user_data) after the specified interval.
|
||||
* The timer is freed if timer_func returns zero.
|
||||
* Otherwise, it's called again after the same interval.
|
||||
*/
|
||||
CcnetTimer* ccnet_timer_new (TimerCB func,
|
||||
void *user_data,
|
||||
uint64_t timeout_milliseconds);
|
||||
|
||||
/**
|
||||
* Frees a timer and sets the timer pointer to NULL.
|
||||
*/
|
||||
void ccnet_timer_free (CcnetTimer **timer);
|
||||
|
||||
|
||||
#endif
|
@ -6,7 +6,6 @@ import sys
|
||||
import configparser
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import ccnet
|
||||
import seafile
|
||||
import re
|
||||
from pysearpc import SearpcError
|
||||
|
@ -8,7 +8,6 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/common \
|
||||
@CCNET_CFLAGS@ \
|
||||
@SEARPC_CFLAGS@ \
|
||||
@GLIB2_CFLAGS@ \
|
||||
@MSVC_CFLAGS@ \
|
||||
@ -77,8 +76,7 @@ seaf_server_SOURCES = \
|
||||
../common/merge-new.c \
|
||||
../common/block-tx-utils.c
|
||||
|
||||
seaf_server_LDADD = @CCNET_LIBS@ \
|
||||
$(top_builddir)/lib/libseafile_common.la \
|
||||
seaf_server_LDADD = $(top_builddir)/lib/libseafile_common.la \
|
||||
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ -levhtp \
|
||||
$(top_builddir)/common/cdc/libcdc.la \
|
||||
@SEARPC_LIBS@ @JANSSON_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "seafile-object.h"
|
||||
#include "seafile-crypt.h"
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <ccnet/job-mgr.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "seafile-object.h"
|
||||
#include "seafile-error.h"
|
||||
|
@ -6,7 +6,6 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/lib \
|
||||
-I$(top_srcdir)/common \
|
||||
@CCNET_CFLAGS@ \
|
||||
@SEARPC_CFLAGS@ \
|
||||
@GLIB2_CFLAGS@ \
|
||||
@MSVC_CFLAGS@ \
|
||||
@ -45,8 +44,7 @@ seafserv_gc_SOURCES = \
|
||||
gc-core.c \
|
||||
$(common_sources)
|
||||
|
||||
seafserv_gc_LDADD = @CCNET_LIBS@ \
|
||||
$(top_builddir)/common/cdc/libcdc.la \
|
||||
seafserv_gc_LDADD = $(top_builddir)/common/cdc/libcdc.la \
|
||||
$(top_builddir)/lib/libseafile_common.la \
|
||||
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ \
|
||||
@SEARPC_LIBS@ @JANSSON_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
|
||||
@ -57,8 +55,7 @@ seaf_fsck_SOURCES = \
|
||||
fsck.c \
|
||||
$(common_sources)
|
||||
|
||||
seaf_fsck_LDADD = @CCNET_LIBS@ \
|
||||
$(top_builddir)/common/cdc/libcdc.la \
|
||||
seaf_fsck_LDADD = $(top_builddir)/common/cdc/libcdc.la \
|
||||
$(top_builddir)/lib/libseafile_common.la \
|
||||
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ \
|
||||
@SEARPC_LIBS@ @JANSSON_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "common.h"
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "fsck.h"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <utils.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "gc-core.h"
|
||||
#include "verify.h"
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <jansson.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include <timer.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
#define DEBUG_FLAG SEAFILE_DEBUG_HTTP
|
||||
#include "log.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "seafile-object.h"
|
||||
#include "seafile-crypt.h"
|
||||
#include "seafile-error.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "log.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <ccnet/timer.h>
|
||||
#include <timer.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "seafile-object.h"
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "seafile-session.h"
|
||||
#include "permission-mgr.h"
|
||||
|
@ -5,9 +5,6 @@
|
||||
#include "log.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
#include "seaf-db.h"
|
||||
#include "quota-mgr.h"
|
||||
|
@ -7,8 +7,7 @@
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include <timer.h>
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -7,8 +7,6 @@
|
||||
#include <jansson.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include "utils.h"
|
||||
#define DEBUG_FLAG SEAFILE_DEBUG_OTHER
|
||||
#include "log.h"
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/ccnet-object.h>
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <event2/event.h>
|
||||
#else
|
||||
#include <event.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -12,7 +18,6 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <searpc-server.h>
|
||||
#include <searpc-client.h>
|
||||
|
||||
|
@ -3,9 +3,7 @@
|
||||
#ifndef SEAFILE_SESSION_H
|
||||
#define SEAFILE_SESSION_H
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/cevent.h>
|
||||
#include <ccnet/job-mgr.h>
|
||||
#include <job-mgr.h>
|
||||
|
||||
#include "block-mgr.h"
|
||||
#include "fs-mgr.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "seaf-db.h"
|
||||
#include "log.h"
|
||||
#include "seafile-error.h"
|
||||
#include <ccnet/ccnet-object.h>
|
||||
|
||||
SeafShareManager *
|
||||
seaf_share_manager_new (SeafileSession *seaf)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet/timer.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
|
@ -7,8 +7,7 @@
|
||||
#define DEBUG_FLAG SEAFILE_DEBUG_OTHER
|
||||
#include "log.h"
|
||||
|
||||
#include <ccnet.h>
|
||||
#include <ccnet/job-mgr.h>
|
||||
#include <timer.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "seafile-session.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <ccnet/timer.h>
|
||||
#include <timer.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
#include <pthread.h>
|
||||
#include <jansson.h>
|
||||
|
||||
#include <ccnet.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <timer.h>
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
#include "seafile-error.h"
|
||||
|
Loading…
Reference in New Issue
Block a user