diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:40:55 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:40:55 +0100 |
| commit | 5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda (patch) | |
| tree | 1acdfa5220cd13b7be43a2a01368e80d306473ca /examples/redis-unstable/src/bio.h | |
| parent | c7ab12bba64d9c20ccd79b132dac475f7bc3923e (diff) | |
| download | crep-5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda.tar.gz | |
Add Redis source code for testing
Diffstat (limited to 'examples/redis-unstable/src/bio.h')
| -rw-r--r-- | examples/redis-unstable/src/bio.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/redis-unstable/src/bio.h b/examples/redis-unstable/src/bio.h new file mode 100644 index 0000000..615cf45 --- /dev/null +++ b/examples/redis-unstable/src/bio.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009-Present, Redis Ltd. + * All rights reserved. + * + * Licensed under your choice of (a) the Redis Source Available License 2.0 + * (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the + * GNU Affero General Public License v3 (AGPLv3). + */ + +#ifndef __BIO_H +#define __BIO_H + +typedef void lazy_free_fn(void *args[]); +typedef void comp_fn(uint64_t user_data, void *user_ptr); + +typedef enum bio_worker_t { + BIO_WORKER_CLOSE_FILE = 0, + BIO_WORKER_AOF_FSYNC, + BIO_WORKER_LAZY_FREE, + BIO_WORKER_NUM +} bio_worker_t; + +/* Background job opcodes */ +typedef enum bio_job_type_t { + BIO_CLOSE_FILE = 0, /* Deferred close(2) syscall. */ + BIO_AOF_FSYNC, /* Deferred AOF fsync. */ + BIO_LAZY_FREE, /* Deferred objects freeing. */ + BIO_CLOSE_AOF, + BIO_COMP_RQ_CLOSE_FILE, /* Job completion request, registered on close-file worker's queue */ + BIO_COMP_RQ_AOF_FSYNC, /* Job completion request, registered on aof-fsync worker's queue */ + BIO_COMP_RQ_LAZY_FREE, /* Job completion request, registered on lazy-free worker's queue */ + BIO_NUM_OPS +} bio_job_type_t; + +/* Exported API */ +void bioInit(void); +unsigned long bioPendingJobsOfType(int type); +void bioDrainWorker(int job_type); +void bioKillThreads(void); +void bioCreateCloseJob(int fd, int need_fsync, int need_reclaim_cache); +void bioCreateCloseAofJob(int fd, long long offset, int need_reclaim_cache); +void bioCreateFsyncJob(int fd, long long offset, int need_reclaim_cache); +void bioCreateLazyFreeJob(lazy_free_fn free_fn, int arg_count, ...); +void bioCreateCompRq(bio_worker_t assigned_worker, comp_fn *func, uint64_t user_data, void *user_ptr); + + +#endif |
