Remove redundant Store.with_id
git-svn-id: file:///srv/svn/repo/kosuzu/trunk@11 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
parent
03b7ef8563
commit
ee326c3cf8
@ -94,18 +94,6 @@ let fold ?(r=false) ?(dir=def_dir ()) ?(predicate=fun _ -> true) ?order ?number
|
|||||||
| None -> List.fold_left fn acc @@ TextMap.bindings @@
|
| None -> List.fold_left fn acc @@ TextMap.bindings @@
|
||||||
List.fold_left (fold_valid_text predicate) new_iteration flist
|
List.fold_left (fold_valid_text predicate) new_iteration flist
|
||||||
|
|
||||||
let with_id ?(r=false) ?(dir=def_dir ()) id =
|
|
||||||
let matched acc path =
|
|
||||||
match to_text path with
|
|
||||||
| Error x -> prerr_endline x; acc
|
|
||||||
| Ok text when text.Text.id <> id -> acc
|
|
||||||
| Ok text ->
|
|
||||||
match acc with
|
|
||||||
| Ok None -> Ok (Some text)
|
|
||||||
| Ok (Some prev) -> if prev = text then acc else Error [text; prev]
|
|
||||||
| Error x -> Error (text :: x)
|
|
||||||
in List.fold_left matched (Ok None) (list_fs ~r dir)
|
|
||||||
|
|
||||||
let with_dir ?(descr="") ?(perm=0o740) dir =
|
let with_dir ?(descr="") ?(perm=0o740) dir =
|
||||||
let mkdir dir = match Unix.mkdir dir perm with
|
let mkdir dir = match Unix.mkdir dir perm with
|
||||||
| exception Unix.Unix_error (EEXIST, _, _) -> ()
|
| exception Unix.Unix_error (EEXIST, _, _) -> ()
|
||||||
|
@ -8,7 +8,6 @@ module type T = sig
|
|||||||
val of_path: string -> (archive_t, string) result
|
val of_path: string -> (archive_t, string) result
|
||||||
val newest: record_t -> record_t -> int
|
val newest: record_t -> record_t -> int
|
||||||
val oldest: record_t -> record_t -> int
|
val oldest: record_t -> record_t -> int
|
||||||
val with_id: archive_t -> Id.t -> (Text.t option, Text.t list) result
|
|
||||||
val with_text: archive_t -> Text.t -> (string * Text.t, string) result
|
val with_text: archive_t -> Text.t -> (string * Text.t, string) result
|
||||||
val iter: ?predicate:(Text.t -> bool) -> ?order:(record_t -> record_t -> int) -> ?number:int
|
val iter: ?predicate:(Text.t -> bool) -> ?order:(record_t -> record_t -> int) -> ?number:int
|
||||||
-> (record_t -> unit) -> archive_t -> unit
|
-> (record_t -> unit) -> archive_t -> unit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user