Header And Logo

PostgreSQL
| The world's most advanced open source database.

ts_cache.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * ts_cache.h
00004  *    Tsearch related object caches.
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  * src/include/tsearch/ts_cache.h
00010  *
00011  *-------------------------------------------------------------------------
00012  */
00013 #ifndef TS_CACHE_H
00014 #define TS_CACHE_H
00015 
00016 #include "utils/guc.h"
00017 
00018 
00019 /*
00020  * All TS*CacheEntry structs must share this common header
00021  * (see InvalidateTSCacheCallBack)
00022  */
00023 typedef struct TSAnyCacheEntry
00024 {
00025     Oid         objId;
00026     bool        isvalid;
00027 } TSAnyCacheEntry;
00028 
00029 
00030 typedef struct TSParserCacheEntry
00031 {
00032     /* prsId is the hash lookup key and MUST BE FIRST */
00033     Oid         prsId;          /* OID of the parser */
00034     bool        isvalid;
00035 
00036     Oid         startOid;
00037     Oid         tokenOid;
00038     Oid         endOid;
00039     Oid         headlineOid;
00040     Oid         lextypeOid;
00041 
00042     /*
00043      * Pre-set-up fmgr call of most needed parser's methods
00044      */
00045     FmgrInfo    prsstart;
00046     FmgrInfo    prstoken;
00047     FmgrInfo    prsend;
00048     FmgrInfo    prsheadline;
00049 } TSParserCacheEntry;
00050 
00051 typedef struct TSDictionaryCacheEntry
00052 {
00053     /* dictId is the hash lookup key and MUST BE FIRST */
00054     Oid         dictId;
00055     bool        isvalid;
00056 
00057     /* most frequent fmgr call */
00058     Oid         lexizeOid;
00059     FmgrInfo    lexize;
00060 
00061     MemoryContext dictCtx;      /* memory context to store private data */
00062     void       *dictData;
00063 } TSDictionaryCacheEntry;
00064 
00065 typedef struct
00066 {
00067     int         len;
00068     Oid        *dictIds;
00069 } ListDictionary;
00070 
00071 typedef struct
00072 {
00073     /* cfgId is the hash lookup key and MUST BE FIRST */
00074     Oid         cfgId;
00075     bool        isvalid;
00076 
00077     Oid         prsId;
00078 
00079     int         lenmap;
00080     ListDictionary *map;
00081 } TSConfigCacheEntry;
00082 
00083 
00084 /*
00085  * GUC variable for current configuration
00086  */
00087 extern char *TSCurrentConfig;
00088 
00089 
00090 extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId);
00091 extern TSDictionaryCacheEntry *lookup_ts_dictionary_cache(Oid dictId);
00092 extern TSConfigCacheEntry *lookup_ts_config_cache(Oid cfgId);
00093 
00094 extern Oid  getTSCurrentConfig(bool emitError);
00095 extern bool check_TSCurrentConfig(char **newval, void **extra, GucSource source);
00096 extern void assign_TSCurrentConfig(const char *newval, void *extra);
00097 
00098 #endif   /* TS_CACHE_H */