1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2011 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
26 struct context_control {
28 void (*filter_destroy)(void *data);
31 static void my_inc(struct rset_key_control *kc)
33 struct context_control *cp;
40 static void my_dec(struct rset_key_control *kc)
42 struct context_control *cp;
47 if (cp->ref_count == 0)
49 if (cp->filter_destroy)
50 (*cp->filter_destroy)(kc->filter_data);
57 struct rset_key_control *zebra_key_control_create(ZebraHandle zh)
59 struct rset_key_control *kc = xmalloc(sizeof(*kc));
60 struct context_control *cp = xmalloc(sizeof(*cp));
63 kc->key_size = sizeof(struct it_key);
64 kc->cmp = key_compare_it;
65 kc->key_logdump_txt = key_logdump_txt;
66 kc->getseq = key_get_seq;
68 if (zh->m_segment_indexing)
70 kc->scope = 3; /* segment + seq is "same" record */
71 kc->get_segment = key_get_segment;
75 kc->scope = 2; /* seq is "same" record */
79 zebra_limit_for_rset(zh->m_limit,
92 * c-file-style: "Stroustrup"
93 * indent-tabs-mode: nil
95 * vim: shiftwidth=4 tabstop=8 expandtab