Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.861 2004/02/09 16:51:40 wellhard Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.862 2004/02/09 18:22:46 wellhard Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:3632:    }    QUERY( "DELETE FROM "+name+" WHERE id="+id );    }    }       int write_dump(Stdio.File file, int|void from_time)    // Write a mapping from id to encoded arg string for all local arg    // entries created after from_time to a file. Returns 0 if faled, 1    // otherwise.    { +  constant FETCH_ROWS = 10000; +  +  if(sizeof(secret+"\n") != file->write(secret+"\n")) +  return 0; +  +  // The server does only need to use file based argcache +  // replication if the server don't participate in a replicate +  // setup with a shared database. +  if( !has_value((plugins->is_functional-({0}))(), 1) ) +  { +  int cursor;    array(int) ids; -  if(!sizeof(plugins)) { +  do {    if(from_time) -  ids = (array(int)) +  // Only replicate entries accessed during the prefetch crawling. +  ids = +  (array(int))    QUERY( "SELECT id from "+name+    " WHERE atime >= %d " -  " AND index_id IS NOT NULL", from_time )->id; +  " AND index_id IS NOT NULL" +  " LIMIT %d, %d", from_time, cursor, FETCH_ROWS)->id;    else -  ids = (array(int)) -  QUERY( "SELECT id from "+name )->id; -  } -  else -  ids = ((plugins->get_local_ids-({0}))(from_time)) * ({}); +  // Make sure _every_ entry is replicated when a dump is created. +  ids = +  (array(int)) +  QUERY( "SELECT id from "+name+ +  " LIMIT %d, %d", cursor, FETCH_ROWS)->id;    -  if(sizeof(secret+"\n") != file->write(secret+"\n")) -  return 0; +  cursor += FETCH_ROWS;       foreach(ids, int id) {    int index_id = read_index_id(id);   #ifdef REPLICATE_DEBUG    werror("write_dump: argcache id: %d, index_id: %d.\n", id, index_id);   #endif       string s =    MIME.encode_base64(encode_value(({ id, read_args(id),    index_id, read_args(index_id) })),    1)+"\n";    if(sizeof(s) != file->write(s))    return 0;    } -  +  } while(sizeof(ids) == FETCH_ROWS); +  }    return file->write("EOF\n") == 4;    }       static void create_remote_key(int id, string key,    int index_id, string index_key,    string server)    {    (plugins->create_remote_key-({0}))( id, key, index_id, index_key, server );    }