netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
sl_xapian.c File Reference
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/stat.h>
#include <unistd.h>
#include <talloc.h>
#include <atalk/cnid.h>
#include <atalk/errchk.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/spotlight.h>
#include <atalk/unix.h>
#include <atalk/util.h>
#include <atalk/volume.h>
#include "etc/spotlight/spotlight_private.h"
#include "etc/spotlight/xapian/sl_xapian.h"

Data Structures

struct  sl_xapian_seeded
 
struct  sl_xapian_query
 

Macros

#define SL_XAPIAN_PAGE_SIZE   20
 
#define SL_XAPIAN_DEFAULT_LIMIT   10000
 
#define SL_XAPIAN_DB_ID_MAX   128
 

Functions

static int sl_xapian_mkdir_state (const char *path, mode_t mode, char *errbuf, size_t errlen)
 
static int sl_xapian_ensure_state_root (char *errbuf, size_t errlen)
 
static int cnid_comp_fn (const void *p1, const void *p2)
 
static bool sl_xapian_path_in_scope (const char *path, const char *scope)
 
static bool sl_xapian_seeded (const struct vol *vol)
 
static int sl_xapian_mark_seeded (const struct vol *vol)
 
static void sl_xapian_unmark_seeded (const struct vol *vol)
 
static bool sl_xapian_db_id_char_safe (unsigned char c)
 
static uint64_t sl_xapian_fnv1a_update (uint64_t hash, const char *s)
 
static bool sl_xapian_db_id_safe (const char *id)
 
static uint64_t sl_xapian_db_id_hash (const struct vol *vol, const char *id)
 
static char * sl_xapian_db_path (TALLOC_CTX *mem_ctx, const struct vol *vol)
 
static const char * sl_xapian_volume_uuid (const struct vol *vol)
 
static int sl_xapian_ensure_seeded (slq_t *slq, const char *db_path)
 
static int sl_xapian_fill_results (slq_t *slq)
 
static int sl_xapian_init (AFPObj *obj)
 
static void sl_xapian_close (AFPObj *obj)
 
static int sl_xapian_open_query (slq_t *slq)
 
static int sl_xapian_fetch_results (slq_t *slq)
 
static void sl_xapian_close_query (slq_t *slq)
 
static int sl_xapian_index_event (const AFPObj *obj, const struct vol *vol, sl_index_event_t event, const char *path, const char *oldpath)
 

Variables

static struct sl_xapian_seededseeded_volumes
 
const sl_backend_ops sl_xapian_ops
 

Macro Definition Documentation

◆ SL_XAPIAN_DB_ID_MAX

#define SL_XAPIAN_DB_ID_MAX   128

◆ SL_XAPIAN_DEFAULT_LIMIT

#define SL_XAPIAN_DEFAULT_LIMIT   10000

◆ SL_XAPIAN_PAGE_SIZE

#define SL_XAPIAN_PAGE_SIZE   20

Function Documentation

◆ cnid_comp_fn()

static int cnid_comp_fn ( const void *  p1,
const void *  p2 
)
static

◆ sl_xapian_close()

static void sl_xapian_close ( AFPObj obj)
static

◆ sl_xapian_close_query()

static void sl_xapian_close_query ( slq_t slq)
static

◆ sl_xapian_db_id_char_safe()

static bool sl_xapian_db_id_char_safe ( unsigned char  c)
static

◆ sl_xapian_db_id_hash()

static uint64_t sl_xapian_db_id_hash ( const struct vol vol,
const char *  id 
)
static

◆ sl_xapian_db_id_safe()

static bool sl_xapian_db_id_safe ( const char *  id)
static

◆ sl_xapian_db_path()

static char * sl_xapian_db_path ( TALLOC_CTX *  mem_ctx,
const struct vol vol 
)
static

◆ sl_xapian_ensure_seeded()

static int sl_xapian_ensure_seeded ( slq_t slq,
const char *  db_path 
)
static

◆ sl_xapian_ensure_state_root()

static int sl_xapian_ensure_state_root ( char *  errbuf,
size_t  errlen 
)
static

◆ sl_xapian_fetch_results()

static int sl_xapian_fetch_results ( slq_t slq)
static

◆ sl_xapian_fill_results()

static int sl_xapian_fill_results ( slq_t slq)
static

◆ sl_xapian_fnv1a_update()

static uint64_t sl_xapian_fnv1a_update ( uint64_t  hash,
const char *  s 
)
static

◆ sl_xapian_index_event()

static int sl_xapian_index_event ( const AFPObj obj,
const struct vol vol,
sl_index_event_t  event,
const char *  path,
const char *  oldpath 
)
static

◆ sl_xapian_init()

static int sl_xapian_init ( AFPObj obj)
static

◆ sl_xapian_mark_seeded()

static int sl_xapian_mark_seeded ( const struct vol vol)
static

◆ sl_xapian_mkdir_state()

static int sl_xapian_mkdir_state ( const char *  path,
mode_t  mode,
char *  errbuf,
size_t  errlen 
)
static

◆ sl_xapian_open_query()

static int sl_xapian_open_query ( slq_t slq)
static

◆ sl_xapian_path_in_scope()

static bool sl_xapian_path_in_scope ( const char *  path,
const char *  scope 
)
static

◆ sl_xapian_seeded()

static bool sl_xapian_seeded ( const struct vol vol)
static

◆ sl_xapian_unmark_seeded()

static void sl_xapian_unmark_seeded ( const struct vol vol)
static

◆ sl_xapian_volume_uuid()

static const char * sl_xapian_volume_uuid ( const struct vol vol)
static

Variable Documentation

◆ seeded_volumes

struct sl_xapian_seeded* seeded_volumes
static

◆ sl_xapian_ops

const sl_backend_ops sl_xapian_ops
Initial value:
= {
.sbo_name = "xapian",
.sbo_init = sl_xapian_init,
.sbo_close = sl_xapian_close,
.sbo_open_query = sl_xapian_open_query,
.sbo_fetch_results = sl_xapian_fetch_results,
.sbo_close_query = sl_xapian_close_query,
.sbo_index_event = sl_xapian_index_event,
}
static int sl_xapian_fetch_results(slq_t *slq)
Definition sl_xapian.c:496
static void sl_xapian_close(AFPObj *obj)
Definition sl_xapian.c:431
static void sl_xapian_close_query(slq_t *slq)
Definition sl_xapian.c:511
static int sl_xapian_open_query(slq_t *slq)
Definition sl_xapian.c:445
static int sl_xapian_index_event(const AFPObj *obj, const struct vol *vol, sl_index_event_t event, const char *path, const char *oldpath)
Definition sl_xapian.c:524
static int sl_xapian_init(AFPObj *obj)
Definition sl_xapian.c:418