Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–77 unchanged (77 lines)
78 /// This is a best-effort optimization hint, and the database may choose to ignore this and
79 /// continue file writes. This happens after the database is invalidated, so it is valid for
80 /// this to leave the database in a half-updated and corrupted state.
81 fn prevent_writes(&self) {
82 // this is an optional performance hint to the database
83 }
84
85 fn shutdown(&self) -> Result<()> {
86 Ok(())
87 }
88}
89

After

…lines 1–78 unchanged (78 lines)
79 /// continue file writes. This happens after the database is invalidated, so it is valid for
80 /// this to leave the database in a half-updated and corrupted state.
81 fn prevent_writes(&self) {
82 // this is an optional performance hint to the database
83 }
84
85 /// Triggers compaction of the database.
86 ///
87 /// Returns `Ok(true)` if compaction actually merged files, `Ok(false)` if there was nothing
88 /// to compact. The default implementation is a no-op.
89 fn compact(&self) -> Result<bool> {
90 Ok(false)
91 }
92
93 fn shutdown(&self) -> Result<()> {
94 Ok(())
95 }
96}
97

Before

source_file
use_declaration
use "use"
scoped_identifier
identifier "anyhow"
:: "::"
identifier "Result"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "smallvec"
:: "::"
identifier "SmallVec"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "turbo_persistence"
:: "::"
use_list
{ "{"
identifier "FamilyConfig"
, ","
identifier "FamilyKind"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "database"
:: "::"
identifier "write_batch"
:: "::"
identifier "ConcurrentWriteBatch"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
) ")"
] "]"
enum_item (+28 nodes collapsed)
impl_item (+92 nodes collapsed)
trait_item
visibility_modifier
pub "pub"
trait "trait"
type_identifier "KeyValueDatabase"
declaration_list
{ "{"
function_item
fn "fn"
identifier "is_empty"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
-> "->"
primitive_type "bool"
block
{ "{"
boolean_literal
false "false"
} "}"
associated_type (+37 nodes collapsed)
function_signature_item (+47 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Looks up a key and returns all matching values.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Useful for keyspaces where keys are hashes and collisions a"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The default implementation returns at most one value (from "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " that support multiple values per key should override this.\n"
function_item (+87 nodes collapsed)
function_item (+126 nodes collapsed)
associated_type (+30 nodes collapsed)
function_signature_item (+27 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Called when the database has been invalidated via\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " [`crate::backing_storage::BackingStorage::invalidate`]\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This typically means that we'll restart the process or `tur"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " database. If this happens, there's no point in writing anyt"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " during [`KeyValueDatabase::shutdown`].\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This is a best-effort optimization hint, and the database m"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " continue file writes. This happens after the database is in"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " this to leave the database in a half-updated and corrupted "...
function_item
fn "fn"
identifier "prevent_writes"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
block
{ "{"
line_comment
// "//"
} "}"
function_item (+29 nodes collapsed)
} "}"

After

source_file
use_declaration
use "use"
scoped_identifier
identifier "anyhow"
:: "::"
identifier "Result"
; ";"
use_declaration
use "use"
scoped_identifier
identifier "smallvec"
:: "::"
identifier "SmallVec"
; ";"
use_declaration
use "use"
scoped_use_list
identifier "turbo_persistence"
:: "::"
use_list
{ "{"
identifier "FamilyConfig"
, ","
identifier "FamilyKind"
} "}"
; ";"
use_declaration
use "use"
scoped_identifier
scoped_identifier
scoped_identifier
crate "crate"
:: "::"
identifier "database"
:: "::"
identifier "write_batch"
:: "::"
identifier "ConcurrentWriteBatch"
; ";"
attribute_item
# "#"
[ "["
attribute
identifier "derive"
token_tree
( "("
identifier "Debug"
, ","
identifier "Clone"
, ","
identifier "Copy"
) ")"
] "]"
enum_item (+28 nodes collapsed)
impl_item (+92 nodes collapsed)
trait_item
visibility_modifier
pub "pub"
trait "trait"
type_identifier "KeyValueDatabase"
declaration_list
{ "{"
function_item
fn "fn"
identifier "is_empty"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
-> "->"
primitive_type "bool"
block
{ "{"
boolean_literal
false "false"
} "}"
associated_type (+37 nodes collapsed)
function_signature_item (+47 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Looks up a key and returns all matching values.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Useful for keyspaces where keys are hashes and collisions a"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " The default implementation returns at most one value (from "...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " that support multiple values per key should override this.\n"
function_item (+87 nodes collapsed)
function_item (+126 nodes collapsed)
associated_type (+30 nodes collapsed)
function_signature_item (+27 nodes collapsed)
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Called when the database has been invalidated via\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " [`crate::backing_storage::BackingStorage::invalidate`]\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This typically means that we'll restart the process or `tur"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " database. If this happens, there's no point in writing anyt"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " during [`KeyValueDatabase::shutdown`].\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " This is a best-effort optimization hint, and the database m"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " continue file writes. This happens after the database is in"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " this to leave the database in a half-updated and corrupted "...
function_item
fn "fn"
identifier "prevent_writes"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
block
{ "{"
line_comment
// "//"
} "}"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Triggers compaction of the database.\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment "\n"
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " Returns `Ok(true)` if compaction actually merged files, `Ok"...
line_comment
// "//"
outer_doc_comment_marker
/ "/"
doc_comment " to compact. The default implementation is a no-op.\n"
function_item
fn "fn"
identifier "compact"
parameters
( "("
self_parameter
& "&"
self "self"
) ")"
-> "->"
generic_type
type_identifier "Result"
type_arguments
< "<"
primitive_type "bool"
> ">"
block
{ "{"
call_expression
identifier "Ok"
arguments
( "("
boolean_literal
false "false"
) ")"
} "}"
function_item (+29 nodes collapsed)
} "}"