Permalink
Browse files

strip out the Inbox and username code, since thats also part of the r…

…emoved scanning implementation
  • Loading branch information...
1 parent 0989f7c commit 04cec2b8969e609828bb8a547c094a7c4e8ae7f4 Anil Madhavapeddy committed Aug 2, 2009
Showing with 39 additions and 279 deletions.
  1. +0 −2 client/ocaml/lifedb.ml
  2. +0 −2 config.json.in
  3. +0 −9 lifedb_config.ml
  4. +32 −235 lifedb_schema.ml
  5. +0 −10 lifedb_schema.mli
  6. +0 −2 lifedb_schema_generator.ml
  7. +0 −1 lifedb_tasks.ml
  8. +1 −1 server.ml
  9. +6 −17 sql_mirror.ml
View
@@ -7,13 +7,11 @@ module Rpc = struct
module Config = struct
type json t = <
lifedb_directory: string;
- inbox_directory: string;
config_directory: string;
plugins_directory: string list;
log_directory: string;
cache_directory: string;
static_directory: string;
- username: string;
port: int
>
end
View
@@ -1,11 +1,9 @@
{
"lifedb_directory" : "$HOME/Documents/LifeDB",
- "inbox_directory" : "$HOME/Documents/LifeINBOX",
"plugins_directory" : [ "$HOME/Library/Application Support/LifeDB/Plugins", "../plugins" ],
"log_directory" : "$HOME/Library/Application Support/LifeDB/Logs",
"cache_directory" : "$HOME/Library/Caches/LifeDB",
"config_directory" : "$HOME/Library/Application Support/LifeDB/Config",
"static_directory" : "./htdocs",
- "username" : "your@email.com",
"port" : 5985
}
View
@@ -24,21 +24,16 @@ module Dir = struct
let plugins_dir = ref []
let config_dir = ref ""
let static_dir = ref ""
- let username_val = ref ""
- let inbox_dir = ref ""
let lifedb () = !lifedb_dir
let lifedb_db () = Filename.concat !lifedb_dir "life.db"
let cache () = !cache_dir
- let uidmap () = Filename.concat !cache_dir "_uidmap"
let log () = !log_dir
let plugins () = !plugins_dir
let config () = !config_dir
let passwd_db () = Filename.concat !config_dir "passwd.db"
let sync_db () = Filename.concat !config_dir "sync.db"
- let username () = !username_val
let static () = !static_dir
- let inbox () = !inbox_dir
end
let port_val = ref 5985
@@ -62,8 +57,6 @@ let read_config file test_mode =
Dir.cache_dir := subst conf#cache_directory;
Dir.config_dir := subst conf#config_directory;
Dir.static_dir := subst conf#static_directory;
- Dir.inbox_dir := subst conf#inbox_directory;
- Dir.username_val := conf#username;
port_val := conf#port;
test_mode_val := test_mode;
config_filename_val := realpath file
@@ -76,8 +69,6 @@ let string_of_config () =
method cache_directory = Dir.cache ()
method config_directory = Dir.config ()
method static_directory = Dir.static ()
- method inbox_directory = Dir.inbox ()
- method username = Dir.username ()
method port = port ()
end) in
Json_io.string_of_json json
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -230,8 +230,6 @@ module Entry : sig
set_atts : Attachment.t list -> unit;
tags : Tag.t list;
set_tags : Tag.t list -> unit;
- inbox : string option;
- set_inbox : string option -> unit;
delivered : int64;
set_delivered : int64 -> unit;
save: int64; delete: unit
@@ -250,7 +248,6 @@ module Entry : sig
recipients:Service.t list ->
atts:Attachment.t list ->
tags:Tag.t list ->
- ?inbox:string option ->
delivered:int64 ->
Init.t -> t
(** Can be used to construct a new object. If [id] is not specified, it will be automatically assigned the first time [save] is called on the object. The object is not committed to the database until [save] is invoked. The [save] method will also return the [id] assigned to the object.
@@ -262,7 +259,6 @@ module Entry : sig
?uid:string option ->
?file_name:string option ->
?created:float option ->
- ?inbox:string option ->
?delivered:int64 option ->
?custom_where:string * Sqlite3.Data.t list -> Init.t -> t list
(** Used to retrieve objects from the database. If an argument is specified, it is included in the search criteria (all fields are ANDed together).
@@ -281,12 +277,6 @@ module Entry : sig
?custom_where:string * Sqlite3.Data.t list -> Init.t ->
float list
- val get_by_inbox_delivered :
- inbox:string option ->
- delivered:int64 ->
- ?custom_where:string * Sqlite3.Data.t list -> Init.t ->
- t list
-
val get_by_uid :
uid:string ->
?custom_where:string * Sqlite3.Data.t list -> Init.t ->
@@ -57,13 +57,11 @@ let lifedb = make [
foreign_many "service" "recipients";
foreign_many "attachment" "atts";
foreign_many "tag" "tags";
- text ~flags:[`Optional; `Index] "inbox";
integer "delivered";
], [
["uid"],[];
["file_name"],[];
["created"],[];
- [],["inbox";"delivered"];
[],["uid"];
[],["file_name"]
], default_opts;
View
@@ -117,7 +117,6 @@ let run_command name cmd cwd secret args silo =
make_dirs lifedb_cache_dir;
let env = Array.append env [| sprintf "LIFEDB_DIR=%s" lifedb_config_dir;
(sprintf "LIFEDB_CACHE_DIR=%s" lifedb_cache_dir);
- (sprintf "LIFEDB_UID_MAP=%s" (Lifedb_config.Dir.uidmap ()));
"LIFEDB_SYNC_DIR=in";
(sprintf "HOME=%s" (Sys.getenv "HOME"));
(sprintf "USER=%s" (Sys.getenv "USER")) |] in
View
@@ -53,7 +53,7 @@ let _ =
(* make and display various directories used by the server *)
List.iter (fun (a,b) ->
Log.push (`Debug (sprintf "%s dir = %s" a b));
- make_dirs b) [ "LifeDB", (LD.lifedb()); "Log", (LD.log()); "Cache", (LD.cache()); "Config", (LD.config()); "Inbox", (LD.inbox()); "UIDMap", (LD.uidmap()) ];
+ make_dirs b) [ "LifeDB", (LD.lifedb()); "Log", (LD.log()); "Cache", (LD.cache()); "Config", (LD.config()) ];
Log.push (`Debug (sprintf "Plugin scan dirs = [%s]" (String.concat " | " (LD.plugins()))));
(* begin the db threads and do a plugin/task scan at start of day *)
View
@@ -56,7 +56,7 @@ let resolve_attachments rootdir fname db uid =
in
checkdir (Filename.dirname fname)
-let process_lifeentry ~inbox db mtypes rootdir fname =
+let process_lifeentry db mtypes rootdir fname =
let json = Json_io.load_json ~big_int_mode:true fname in
let le = Rpc.Entry.t_of_json json in
let mtype_info = try
@@ -124,7 +124,7 @@ let process_lifeentry ~inbox db mtypes rootdir fname =
(* check if this lifedb entry already exists *)
let e = match Entry.get_by_file_name fname db with
|[] ->
- Entry.t ~uid ~inbox ~file_name:fname ~created:le#_timestamp ~mtype:mtype_info ~from ~recipients ~atts ~tags ~delivered:0L db
+ Entry.t ~uid ~file_name:fname ~created:le#_timestamp ~mtype:mtype_info ~from ~recipients ~atts ~tags ~delivered:0L db
|[e] ->
e#set_created le#_timestamp;
e#set_mtype mtype_info;
@@ -140,7 +140,7 @@ let process_lifeentry ~inbox db mtypes rootdir fname =
|_ -> assert false in
ignore(e#save)
-let process_directory ~inbox db throttle_check mtypes rootdir dir =
+let process_directory db throttle_check mtypes rootdir dir =
let dh = opendir dir in
try_final (fun () ->
repeat_until_eof (fun () ->
@@ -149,7 +149,7 @@ let process_directory ~inbox db throttle_check mtypes rootdir dir =
if Filename.check_suffix h ".lifeentry" then begin
let fname = sprintf "%s/%s" dir h in
try
- process_lifeentry ~inbox db mtypes rootdir fname
+ process_lifeentry db mtypes rootdir fname
with e ->
Log.logmod "Mirror" "Exception in %s: %s" fname (Printexc.to_string e)
end
@@ -172,31 +172,20 @@ let dir_is_updated db dir mtime =
|_ -> assert false in
ignore(dir#save)
-let check_directory ?(inbox=None) lifedb syncdb throttle_check mtypes rootdir dir =
+let check_directory lifedb syncdb throttle_check mtypes rootdir dir =
match dir_needs_update syncdb dir with
|Some old_mtime ->
Log.logmod "Mirror" "Processing %s" dir;
- process_directory ~inbox lifedb throttle_check mtypes rootdir dir;
+ process_directory lifedb throttle_check mtypes rootdir dir;
dir_is_updated syncdb dir old_mtime;
|None -> ()
let do_scan ?(subdir="") lifedb syncdb throttle_check =
Log.logmod "Mirror" "Starting scan";
let lifedb_path = Filename.concat (Lifedb_config.Dir.lifedb ()) subdir in
- let inbox_path = Lifedb_config.Dir.inbox () in
let mtypes = get_all_mtypes lifedb in
if not (Lifedb_config.test_mode ()) then begin
walk_directory_tree lifedb_path (check_directory lifedb syncdb throttle_check mtypes lifedb_path);
- if Sys.file_exists inbox_path && (Sys.is_directory inbox_path) then begin
- let dh = opendir inbox_path in
- try_final (fun () ->
- repeat_until_eof (fun () ->
- let folder = read_next_dir dh in
- let inbox_path = Filename.concat inbox_path folder in
- walk_directory_tree inbox_path (check_directory ~inbox:(Some folder) lifedb syncdb throttle_check mtypes inbox_path);
- );
- ) (fun () -> closedir dh)
- end
end;
Log.logmod "Mirror" "Finished scan"

0 comments on commit 04cec2b

Please sign in to comment.