1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2009 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 struct context_control {
25 void (*filter_destroy)(void *data);
28 static void my_inc(struct rset_key_control *kc)
30 struct context_control *cp;
37 static void my_dec(struct rset_key_control *kc)
39 struct context_control *cp;
44 if (cp->ref_count == 0)
46 if (cp->filter_destroy)
47 (*cp->filter_destroy)(kc->filter_data);
54 struct rset_key_control *zebra_key_control_create(ZebraHandle zh)
56 struct rset_key_control *kc = xmalloc(sizeof(*kc));
57 struct context_control *cp = xmalloc(sizeof(*cp));
60 kc->key_size = sizeof(struct it_key);
61 kc->cmp = key_compare_it;
62 kc->key_logdump_txt = key_logdump_txt;
63 kc->getseq = key_get_seq;
65 if (zh->m_segment_indexing)
67 kc->scope = 3; /* segment + seq is "same" record */
68 kc->get_segment = key_get_segment;
72 kc->scope = 2; /* seq is "same" record */
76 zebra_limit_for_rset(zh->m_limit,
89 * indent-tabs-mode: nil
91 * vim: shiftwidth=4 tabstop=8 expandtab