~ubuntu-branches/ubuntu/hardy/steam/hardy

« back to all changes in this revision

Viewing changes to server/modules/nopersistence.pike

  • Committer: Bazaar Package Importer
  • Author(s): Alain Schroeder
  • Date: 2006-11-21 16:03:12 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061121160312-nf96y6nihzsyd2uv
Tags: 2.2.31-3
Add patch to prevent inconsistent data after shutdown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2005  Thomas Bopp, Thorsten Hampel, Ludger Merkens
 
2
 *
 
3
 *  This program is free software; you can redistribute it and/or modify
 
4
 *  it under the terms of the GNU General Public License as published by
 
5
 *  the Free Software Foundation; either version 2 of the License, or
 
6
 *  (at your option) any later version.
 
7
 *
 
8
 *  This program is distributed in the hope that it will be useful,
 
9
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 *  GNU General Public License for more details.
 
12
 *
 
13
 *  You should have received a copy of the GNU General Public License
 
14
 *  along with this program; if not, write to the Free Software
 
15
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 * 
 
17
 */
 
18
inherit "/kernel/module";
 
19
 
 
20
#include <macros.h>
 
21
#include <classes.h>
 
22
#include <database.h>
 
23
#include <exception.h>
 
24
#include <attributes.h>
 
25
#include <access.h>
 
26
 
 
27
static mapping mObjects = ([ ]);
 
28
static mapping mID    = ([ ]);
 
29
static int    __id        = 0;
 
30
static int oid_length = 4;  // nr of bytes for object ids
 
31
static int persistence_id;
 
32
 
 
33
 
 
34
#define PROXY "/kernel/proxy.pike"
 
35
 
 
36
mixed new_object(string id, object obj, string prog_name)
 
37
{
 
38
  if ( !obj->query_attribute(OBJ_TEMP) )
 
39
    return 0;
 
40
  __id++;
 
41
  //int newid = __id | (get_persistence_id() << OID_BITS);
 
42
  int newid = _Persistence->make_object_id( __id );
 
43
  object p = new(PROXY, newid, obj);
 
44
  
 
45
  _Persistence->set_proxy_status(p, PSTAT_SAVE_OK);
 
46
  mObjects[newid] = p;
 
47
  return ({ newid, p });
 
48
}
 
49
 
 
50
object find_object(int|string id)
 
51
{
 
52
  if ( objectp(mObjects[id]) )
 
53
    return mObjects[id];
 
54
}
 
55
 
 
56
bool delete_object(object p)
 
57
{
 
58
  return false;
 
59
}
 
60
 
 
61
int|object load_object(object proxy, int|object oid)
 
62
{
 
63
  return 0;
 
64
}
 
65
 
 
66
void save_object(object proxy, void|string ident, void|string index)
 
67
{
 
68
}
 
69
 
 
70
void require_save(object proxy, void|string indent, void|string index)
 
71
{
 
72
}
 
73
 
 
74
object lookup(string identifier)
 
75
{
 
76
  return 0;
 
77
}
 
78
 
 
79
mixed lookup_user(string identifier, void|string password)
 
80
{
 
81
  return 0;
 
82
}
 
83
 
 
84
mixed lookup_group(string identifier)
 
85
{
 
86
  return 0;
 
87
}
 
88
 
 
89
static void init_module()
 
90
{
 
91
  persistence_id = _Persistence->register( "none", this_object() );
 
92
}
 
93
 
 
94
int get_persistence_id() { return persistence_id; }
 
95
string get_identifier() { return "persistence:none"; }