Commit Graph

44 Commits

Author SHA1 Message Date
Elf M. Sternberg 1c948e41f3 REFACTOR Moving around some code.
This places the parser in its own submodule so that we can be ready
for the next two or three phases of textual analysis.  Right now we
only scan for deliberate references, but the plan is to also scan
for explicit but incidental references, and then to go futher and
go the full tf-idf on the source.
2020-11-12 15:14:42 -08:00
Elf M. Sternberg 3068f18f0c STYLE Clippified.
After running 'cargo clippy,' a few changes were made, and then some
were reverted.  Honestly, 'x.len() > 0' is WAY more readable than
'!x.is_empty()'.  The exclamation mark gets swallowed up by the
surrounding text and is hard to see.
2020-11-12 15:02:45 -08:00
Elf M. Sternberg e3fe863235 REFACTOR A solid final draft. 2020-11-12 14:30:39 -08:00
Elf M. Sternberg 013ca18c62 As cool as the ParentId/NoteId thing was, it didn't feel zero-abstraction,
and it was starting to prove to be clutter.  Maybe it's a mistake to
downtype them to a common type, but I don't think there was that much
risk here.
2020-11-12 13:33:27 -08:00
Elf M. Sternberg 8a83d802d3 REFACTOR Kasten -> Page
I don't speak German, and I kept getting confused about which was
which.  Let's just call it what it is, and worry about presentation
later.
2020-11-12 08:48:57 -08:00
Elf M. Sternberg 5672f2e235 REFACTOR "Build references" is now its own separate chunk of code.
This is good because in used to be somewhat cut-and-paste, and
that's just ugly.  There's a lot of commonality between "insert note"
and "update content," since both rely heavily on parsing the content
in order to establish the web of relationships between notes and pages,
so having that algorithm ONCE makes me happier.
2020-11-12 08:44:20 -08:00
Elf M. Sternberg 6bd14057ab Apparently updated some docs. 2020-11-12 07:27:45 -08:00
Elf M. Sternberg cf6f906fa4 It has the secret for nested transactions. 2020-11-10 20:08:26 -08:00
Elf M. Sternberg ec81083aa9 REFACTOR Moved the 'store' into its own module. 2020-11-10 12:52:44 -08:00
Elf M. Sternberg bad0de9bc0 Mostly documentation changes, but I do want to emphasize that by the
time we hit this layer, the distinction between an API note and a
REST note have been made.
2020-11-06 14:43:05 -08:00
Elf M. Sternberg 2eeb96a26a Enabling the tree-handling API. 2020-11-05 09:34:21 -08:00
Elf M. Sternberg 83d5858a45 Refinements to the tree structure. 2020-11-05 08:30:02 -08:00
Elf M. Sternberg 4776541df4 A little store-level constraining never hurt nobody. 2020-11-05 05:45:57 -08:00
Elf M. Sternberg 9337b98ad3 REFACTOR Again! note->note and note->kasten are now separate tables
This was getting semantically confusing, so I decided to short
circuit the whole mess by separating the two.  The results are
promising.  It does mean that deleting a note means traversing
two tables to clean out all the cruft, which is *sigh*, but it
also means that the tree is stored in one table and the graph in
another, giving us a much better separation of concerns down at
the SQL layer.
2020-11-04 17:53:25 -08:00
Elf M. Sternberg 1bbe8c1ee8 Completely revamped the internal structures.
This removes the page/note dichotomy, since it wasn't working
as well as I'd hoped.  The discipline required now is higher
where the data store layer is concerned, but the actual structures
are smaller and more efficient.
2020-11-04 12:54:17 -08:00
Elf M. Sternberg 0a2b96cea6 This is wrong, but it's something. 2020-11-02 21:56:45 -08:00
Elf M. Sternberg 77ca6d0304 A reset for the single table case. 2020-11-02 18:32:01 -08:00
Elf M. Sternberg da44610098 Reverse reference SQL written.
This is pretty hairy, because we're relying on the LEFT JOIN feature
to give us the root node when we need it.  That's kinda ugly, but
it seems to work just fine.  It also gives us the list in the
*correct* order, so the only thing we need to do is go to the last
item in the returned vector, make sure it's a root node, then go
fetch the page so we can decorate the list with the *right* root.
We'll pass this as a JSON object { [notes-in-reverse], page }.
2020-10-29 10:50:31 -07:00
Elf M. Sternberg dd61f8c0c2 Working on the API that translates the simple vector into a
tree-like structure suitable to RESTification.
2020-10-28 18:22:43 -07:00
Elf M. Sternberg 8c8352259a Hey, all the (current) tests are passing. That's... kinda nifty. 2020-10-26 19:49:38 -07:00
Elf M. Sternberg 72fb3b11ee FEAT Delete & Update note is now complete.
Well, as complete as it could be without proper automated testing.
I think there'll be some more testing soon, as it doesn't make sense
for it to hang out so blatantly like this.

Both a fmt and clippy pass have shaken all the lint off, and right
now it builds without warnings or lintings.  Wheee!
2020-10-26 18:54:56 -07:00
Elf M. Sternberg 739ff93427 Note/Page reference relationships now built. 2020-10-16 07:16:57 -07:00
Elf M. Sternberg 0f98dc4523 MERGE Shrinkwrap and Comrak updates. 2020-10-13 18:03:12 -07:00
Elf M. Sternberg 417320b27c FEAT Parsing the content for references
This features all of the reference types that I commonly use,
including the ORG mode [[Title]], #CamelCase, #lisp-case, and #colon:case.
There are still edge cases around capitalization and the mixing of symbols
and numbers, and I'll have to hack on those until I'm satisfied.
2020-10-13 18:01:20 -07:00
Elf M. Sternberg 4e04bb47d5 FEAT: Reference parser is now working.
It's probably not the fastest thing in the world, but
it's going to be enough for now.
2020-10-13 17:23:24 -07:00
Elf M. Sternberg 7639d1a6f2 Merge remote-tracking branch 'refs/remotes/origin/reboot-20201004' into reboot-20201004
This code now uses the ParentId/NoteId dichotomy supported with
Shrinkwrap.  It's actually very nice.

* refs/remotes/origin/reboot-20201004:
  FEAT: Move note now works.
2020-10-12 20:53:59 -07:00
Elf M. Sternberg bb841c7769 Named ID references. 2020-10-12 20:44:27 -07:00
Elf M. Sternberg 1c0f3abd6c FEAT: Move note now works. 2020-10-12 20:43:49 -07:00
Elf M. Sternberg 380d3f4a7c FEAT: It is now theoretically possible to add a nested note. 2020-10-11 12:14:44 -07:00
Elf M. Sternberg 1b36183edb Holy chao. The CTE works. 2020-10-09 14:01:47 -07:00
Elf M. Sternberg e429eaf93c TEST FAILING; the CTE isn't solid. Needs revision and testing. 2020-10-09 13:06:09 -07:00
Elf M. Sternberg fd4f39b5b8 It compiles. Whether it works is still ¯\_(ツ)_/¯ 2020-10-09 09:57:43 -07:00
Elf M. Sternberg 1b8e1c067d derive_builder pattern is applied successfully.
This is mostly an exercise to understand the derive_builder pattern.
It required a few tips to get it working, but in the end, it's
actually what I want.

I also learned a lot about how the Executor pattern, the Results<> object,
error mapping, and futures interact in this code.  This is going to be
incredibly useful long-term, as long as I still keep this project "live"
in my head.
2020-10-08 12:18:08 -07:00
Elf M. Sternberg e0c463f9fc Not working. 2020-10-06 08:01:25 -07:00
Elf M. Sternberg 0f5d15ad14 FEAT Can update a raw note. 2020-09-30 09:17:37 -07:00
Elf M. Sternberg 1565fef001 REFACTOR: Dry'ing out the insert_new_note feature.
Since both `insert_page` and `insert_note` need to insert a note,
having that code twice in the same block was annoying, especially
since discovering that my oh-so-clever use of `include_str!`
precludes me from using the `query!` macros, which want the strings
included *before* doing analysis.

All that wrestling with the Transaction type turned out to be much
simpler when I was able to just devolve it into an Executor.
2020-09-30 08:53:45 -07:00
Elf M. Sternberg 75809d821d FEAT: Can save a new page. Automagically includes its root note. 2020-09-30 07:37:18 -07:00
Elf M. Sternberg 6bc8b0e911 FEAT Can now retrieve and individual date by public ID. 2020-09-29 18:24:34 -07:00
Elf M. Sternberg 2e08b02def FEAT Enabled chrono datetimes in the database. 2020-09-29 14:27:11 -07:00
Elf M. Sternberg 884822a230 DOC Rustfmt works.
TEST Added test to reassure myself that Arc copies of the storage pool
     are working as planned.
2020-09-29 08:08:30 -07:00
Elf M. Sternberg 71dfc479d8 FEAT Can get a raw note.
TEST Asserts a non-existent raw note is non-existent.
2020-09-29 07:44:43 -07:00
Elf M. Sternberg 8ee71c76a3 FEAT Can initialize the database and fail to retrieve a page.
In the great tradition of TPP, this is a win.  We've gone through
the test driven development, and there is so much *learning* here:

- tokio::test NEEDS the threaded_schedular feature to report errors correctly
- thiserror can't do enum variants the way I expected
- Different error types for different returns is not kosher
- Serde's configuration NEEDS a type, such as JSON, to work,
- Rust has include_str!(), to embed text in a Rust program from an external source
- SQLX is still a pain, but it's managable.
2020-09-28 17:33:43 -07:00
Elf M. Sternberg 2bd7c0aaad DOC Phase one committed to the project, the basic layout of the backstore.
Just describing my vague TPP-level commitments to the project.
2020-09-27 05:35:37 -07:00
Elf M. Sternberg 7f81aa12a0 Initial commit 2020-09-27 05:34:32 -07:00