objective categorical abstract machine language personal data server

Use path in addition to since to sort records

futur.blue 20afdee2 f6cddaa7

verified
+5 -5
+1 -1
pegasus/lib/repository.ml
··· 550 mst_node_cids 551 in 552 (* collect record data for insert *) 553 - let since = Tid.now () in 554 let record_data, blob_refs = 555 List.fold_left 556 (fun (acc_data, acc_refs) (path, cid) -> 557 match Block_map.get cid all_blocks with 558 | Some data -> 559 let record = Lex.of_cbor data in 560 let record_refs = 561 Util.find_blob_refs record
··· 550 mst_node_cids 551 in 552 (* collect record data for insert *) 553 let record_data, blob_refs = 554 List.fold_left 555 (fun (acc_data, acc_refs) (path, cid) -> 556 match Block_map.get cid all_blocks with 557 | Some data -> 558 + let since = Tid.now () in 559 let record = Lex.of_cbor data in 560 let record_refs = 561 Util.find_blob_refs record
+4 -4
pegasus/lib/user_store.ml
··· 155 get_many 156 {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records 157 WHERE path LIKE %string{collection} || '/' || '%' 158 - AND (since < %string{cursor} OR %string{cursor} = '') 159 - ORDER BY since DESC LIMIT %int{limit} 160 |sql}] 161 162 let count_records = ··· 173 get_many 174 {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records 175 WHERE path LIKE %string{collection} || '/' || '%' 176 - AND (since > %string{cursor} OR %string{cursor} = '') 177 - ORDER BY since ASC LIMIT %int{limit} 178 |sql}] 179 180 let put_record =
··· 155 get_many 156 {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records 157 WHERE path LIKE %string{collection} || '/' || '%' 158 + AND (since || path < %string{cursor} OR %string{cursor} = '') 159 + ORDER BY since DESC, path DESC LIMIT %int{limit} 160 |sql}] 161 162 let count_records = ··· 173 get_many 174 {sql| SELECT @string{path}, @CID{cid}, @Blob{data}, @string{since} FROM records 175 WHERE path LIKE %string{collection} || '/' || '%' 176 + AND (since || path > %string{cursor} OR %string{cursor} = '') 177 + ORDER BY since ASC, path ASC LIMIT %int{limit} 178 |sql}] 179 180 let put_record =