Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
925de6d3
Commit
925de6d3
authored
Feb 20, 1994
by
Pontus Hagland
Browse files
Rewritten.
parent
2daba666
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server/cache.h
View file @
925de6d3
/*
* $Id: cache.h,v 0.1
1
199
3
/0
8/04 23:01:33 ceder
Exp $
* $Id: cache.h,v 0.1
2
199
4
/0
2/20 14:14:15 law
Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
...
...
@@ -23,226 +23,111 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se.
*/
/*
* $Id: cache.h,v 0.11 1993/08/04 23:01:33 ceder Exp $
*
* This file contains the cached data that the server stores.
* .h file created by ceder 1990-04-18
* database cache header file
*/
/* cache_sync_all only returns when everything is written to disk. */
extern
void
cache_sync_all
(
void
);
/* First, some things which I want here. /ceder */
struct
matching_info
*
match_table
;
/* match_table, see build_matching_info() */
extern
struct
matching_info
*
match_table
;
extern
void
cached_lock_conf
(
Conf_no
conf_no
);
/******** initiation and shutdown of cache *******************************/
extern
Success
init
_cache
(
void
);
Success
init_cache
(
void
);
/*
init
iate cache (called at initiation/startup of server) */
extern
void
cached_unlock_conf
(
Conf_no
conf
);
void
free_all_cache
(
void
);
/* flush, shutdown cache and free all cache memory (called at shutdown) */
extern
void
cached_lock_person
(
Pers_no
pers
);
void
cache_emergency_exit
(
void
);
/* dump emergency files, etc, if possible */
extern
void
cached_unlock_person
(
Pers_no
pers
);
/******** miscellanous cache master routines *****************************/
extern
Success
cached_delete_person
(
Pers_no
pres
);
void
cache_limit_size
(
void
);
/* end-of-atomic, may clear read entries */
extern
Success
cached_delete_text
(
Text_no
text
);
void
cache_sync
(
void
);
/* flush all, dont wait for disk */
extern
Success
build_matching_info
(
void
);
Bool
sync_part
(
void
);
/* sync timout routine, TRUE=>long timeout before next */
extern
void
/* Write out everything. */
cache_sync
(
void
);
void
cache_sync_all
(
void
);
/* flush all & wait until disk is synced */
/* S}d{r ja. Tack f|r mig. /ceder */
void
tell_cache_garb_text
(
int
running
);
/* tell cache that garb_text is in progress, ie never flush cache */
/*
* Name caching routines
*/
/*
* change_name changes the cached conference name. It is only called when
* a conference name is changed or a conference is deleted.
*
* cached_change_name(foo, EMPTY_STRING); should be used when a conference
* is deleted. (Eller ska det vara annorlunda? S} g|r jag nu... /ceder)
*/
extern
void
cached_change_name
(
Conf_no
name_num
,
String
new_name
);
void
dump_cache_stats
(
FILE
*
stat_file
);
void
dump_cache_mem_usage
(
FILE
*
stat_file
);
/* dump cache statistics etc */
/******** object manipulation routines ***********************************/
extern
Bool
cached_conf_exists
(
Conf_no
conf_no
);
void
mark_person_as_changed
(
Pers_no
pers
);
void
mark_text_as_changed
(
Text_no
text
);
void
mark_conference_as_changed
(
Conf_no
conf
);
/* mark as changed (object is to be re-written to disk) */
/*
* Calls for the cacheing of conf_type:
* cached_get_conf_type() returns the type.
* The type is set when mark_conference_as_changed is called.
*/
void
cached_lock_conf
(
Conf_no
conf
);
void
cached_unlock_conf
(
Conf_no
conf
);
void
cached_lock_person
(
Pers_no
pers
);
void
cached_unlock_person
(
Pers_no
pers
);
/* lock (do never remove object from memory) & unlock
*/
/* Get conference type */
/* Undefined result if the conf doesn't exist. */
Success
cached_create_person
(
Pers_no
pers
);
Conf_no
cached_create_conf
(
String
name
);
Text_no
cached_create_text
(
const
String
message
);
/* create object (returns FALSE if person existed) */
extern
Conf_type
cached_get_conf_type
(
Conf_no
conf_no
);
Person
*
cached_get_person_stat
(
Pers_no
person
);
Conference
*
cached_get_conf_stat
(
Conf_no
conf
);
Text_stat
*
cached_get_text_stat
(
Text_no
text
);
/* get object from database */
/*
* Return number of conferences present. (Actually, return a number
* at least as large as the number of conferences present).
*/
extern
Conf_no
cached_no_of_existing_conferences
(
void
);
String
cached_get_text
(
Text_no
text
);
/* return text. String is to be freed by caller */
/*
* Get garb_nice for a certain conference.
* It is set when mark_conference_as_changed is called.
*/
extern
Garb_nice
cached_get_garb_nice
(
Conf_no
conf_no
);
Success
cached_delete_person
(
Pers_no
pers
);
Success
cached_delete_text
(
Text_no
text
);
Success
cached_delete_conf
(
Conf_no
conf
);
/* remove object from database */
extern
String
cached_get_name
(
Conf_no
conf_no
);
Pers_no
traverse_person
(
Pers_no
sead
);
Conf_no
traverse_conference
(
Conf_no
sead
);
Text_no
traverse_text
(
Text_no
sead
);
/* return number of next existing object */
ext
ern
Local_text_no
cached_get_highest_local_no
(
Conf_no
conf_no
);
T
ext
_no
query_next_text_num
(
void
);
/* returns highest text_num +1 */
/******** misc conference routines **************************************/
/*
* Various function calls to tell the cache that something is changed.
*/
void
cached_change_name
(
Conf_no
conf
,
String
new_name
);
/*
change conferance name
cached_change_name(foo,EMPTY_STRING);
is used when a conference is deleted
*/
void
mark_person_as_changed
(
Pers_no
pers_no
);
Bool
cached_conf_exists
(
Conf_no
conf
);
/* returns TRUE when a conference exists */
Conf_type
cached_get_conf_type
(
Conf_no
conf
);
/* returns conference type
conf_type is set when mark_conference_as_changed is called (?) */
void
mark_conference_as_changed
(
Conf_no
conf_no
);
Garb_nice
cached_get_garb_nice
(
Conf_no
conf
);
/* Get garb_nice from smallconf */
String
cached_get_name
(
Conf_no
conf
);
/* returns conference name from smallconf */
void
mark_text_as_changed
(
Text_no
text_no
);
Local_text_no
cached_get_highest_local_no
(
Conf_no
conf
);
/* returns highes text number in a certain conference */
Success
cached_lookup_name
(
const
String
name
,
Conf_list_old
*
result
);
/* match from name => conf_list_old */
/******** miscellanous wierd routines ************************************/
Success
build_matching_info
(
void
);
/*
* Person-related calls
*/
extern
Success
cached_create_person
(
Pers_no
person
);
extern
Person
*
cached_get_person_stat
(
Pers_no
person
);
/* Returns NULL if person
doesn't exist */
/*
* Conference-related calls
*/
extern
Conf_no
cached_create_conf
(
String
name
);
extern
Success
cached_delete_conf
(
Conf_no
conf
);
extern
Success
cached_lookup_name
(
const
String
name
,
Conf_list_old
*
result
);
extern
Conference
*
cached_get_conf_stat
(
Conf_no
conf_no
);
/*
* Calls to handle texts
*/
extern
String
cached_get_text
(
Text_no
text
);
/* The string should be free'd by the caller */
extern
Text_stat
*
cached_get_text_stat
(
Text_no
text
);
extern
Text_no
cached_create_text
(
const
String
message
);
/*
* traverse_text can be used to cycle through all existing texts. 0 will
* be returned once in the "cycle".
*/
extern
Text_no
traverse_text
(
Text_no
seed
);
/*
* traverse_person can be used to cycle through all existing persons. 0 will
* be returned once in the "cycle".
*/
extern
Pers_no
traverse_person
(
Pers_no
seed
);
/*
* traverse_conference can be used to cycle through all existing conferences.
* 0 will be returned once in the "cycle".
*/
extern
Conf_no
traverse_conference
(
Conf_no
seed
);
/*
* Free all memory used by the cache. This should only be done
* as part of the shutdown sequence. The purpose of this is to
* make it possible to see if there are any memory leaks.
*/
void
free_all_cache
(
void
);
/*
* Limit the number of 'clean' cache entries.
*/
void
cache_limit_size
(
void
);
/*
* Dump cache statistics.
*/
void
dump_cache_stats
(
FILE
*
stat_file
);
/*
* Dump memory usage.
*/
void
dump_cache_mem_usage
(
FILE
*
stat_file
);
/*
* Export the highest text_no for searching.
*/
int
query_next_text_num
(
void
);
/*
* Tell the cache that a text garbage collection operation is in progress
* or is finished.
*/
void
tell_cache_garb_text
(
int
running
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment