|
|
@ -52,6 +52,7 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_targets: &BTreeSet<SmartString<LazyCompact>>,
|
|
|
|
callback_targets: &BTreeSet<SmartString<LazyCompact>>,
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
|
|
|
|
force_collect: &str,
|
|
|
|
) -> Result<Vec<(Vec<u8>, Vec<u8>)>> {
|
|
|
|
) -> Result<Vec<(Vec<u8>, Vec<u8>)>> {
|
|
|
|
let mut to_clear = vec![];
|
|
|
|
let mut to_clear = vec![];
|
|
|
|
let mut replaced_old_triggers = None;
|
|
|
|
let mut replaced_old_triggers = None;
|
|
|
@ -141,17 +142,18 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector,
|
|
|
|
callback_collector,
|
|
|
|
propagate_triggers,
|
|
|
|
propagate_triggers,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut relation_store,
|
|
|
|
&relation_store,
|
|
|
|
metadata,
|
|
|
|
metadata,
|
|
|
|
key_bindings,
|
|
|
|
key_bindings,
|
|
|
|
op == RelationOp::Delete,
|
|
|
|
op == RelationOp::Delete,
|
|
|
|
|
|
|
|
force_collect,
|
|
|
|
*span,
|
|
|
|
*span,
|
|
|
|
)?,
|
|
|
|
)?,
|
|
|
|
RelationOp::Ensure => self.ensure_in_relation(
|
|
|
|
RelationOp::Ensure => self.ensure_in_relation(
|
|
|
|
res_iter,
|
|
|
|
res_iter,
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
cur_vld,
|
|
|
|
cur_vld,
|
|
|
|
&mut relation_store,
|
|
|
|
&relation_store,
|
|
|
|
metadata,
|
|
|
|
metadata,
|
|
|
|
key_bindings,
|
|
|
|
key_bindings,
|
|
|
|
*span,
|
|
|
|
*span,
|
|
|
@ -160,7 +162,7 @@ impl<'a> SessionTx<'a> {
|
|
|
|
res_iter,
|
|
|
|
res_iter,
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
cur_vld,
|
|
|
|
cur_vld,
|
|
|
|
&mut relation_store,
|
|
|
|
&relation_store,
|
|
|
|
metadata,
|
|
|
|
metadata,
|
|
|
|
key_bindings,
|
|
|
|
key_bindings,
|
|
|
|
*span,
|
|
|
|
*span,
|
|
|
@ -174,9 +176,10 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector,
|
|
|
|
callback_collector,
|
|
|
|
propagate_triggers,
|
|
|
|
propagate_triggers,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut relation_store,
|
|
|
|
&relation_store,
|
|
|
|
metadata,
|
|
|
|
metadata,
|
|
|
|
key_bindings,
|
|
|
|
key_bindings,
|
|
|
|
|
|
|
|
force_collect,
|
|
|
|
*span,
|
|
|
|
*span,
|
|
|
|
)?,
|
|
|
|
)?,
|
|
|
|
RelationOp::Create | RelationOp::Replace | RelationOp::Put | RelationOp::Insert => self
|
|
|
|
RelationOp::Create | RelationOp::Replace | RelationOp::Put | RelationOp::Insert => self
|
|
|
@ -189,11 +192,12 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector,
|
|
|
|
callback_collector,
|
|
|
|
propagate_triggers,
|
|
|
|
propagate_triggers,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut to_clear,
|
|
|
|
&mut relation_store,
|
|
|
|
&relation_store,
|
|
|
|
metadata,
|
|
|
|
metadata,
|
|
|
|
key_bindings,
|
|
|
|
key_bindings,
|
|
|
|
dep_bindings,
|
|
|
|
dep_bindings,
|
|
|
|
op == RelationOp::Insert,
|
|
|
|
op == RelationOp::Insert,
|
|
|
|
|
|
|
|
force_collect,
|
|
|
|
*span,
|
|
|
|
*span,
|
|
|
|
)?,
|
|
|
|
)?,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -211,14 +215,15 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
relation_store: &mut RelationHandle,
|
|
|
|
relation_store: &RelationHandle,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
dep_bindings: &[Symbol],
|
|
|
|
dep_bindings: &[Symbol],
|
|
|
|
is_insert: bool,
|
|
|
|
is_insert: bool,
|
|
|
|
|
|
|
|
force_collect: &str,
|
|
|
|
span: SourceSpan,
|
|
|
|
span: SourceSpan,
|
|
|
|
) -> Result<()> {
|
|
|
|
) -> Result<()> {
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name);
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name) || force_collect == &relation_store.name;
|
|
|
|
|
|
|
|
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
@ -235,9 +240,9 @@ impl<'a> SessionTx<'a> {
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
)?;
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
|
|
let need_to_collect = !relation_store.is_temp
|
|
|
|
let need_to_collect = !force_collect.is_empty() || (!relation_store.is_temp
|
|
|
|
&& (is_callback_target
|
|
|
|
&& (is_callback_target
|
|
|
|
|| (propagate_triggers && !relation_store.put_triggers.is_empty()));
|
|
|
|
|| (propagate_triggers && !relation_store.put_triggers.is_empty())));
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
@ -524,12 +529,13 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
relation_store: &mut RelationHandle,
|
|
|
|
relation_store: &RelationHandle,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
|
|
|
|
force_collect: &str,
|
|
|
|
span: SourceSpan,
|
|
|
|
span: SourceSpan,
|
|
|
|
) -> Result<()> {
|
|
|
|
) -> Result<()> {
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name);
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name) || force_collect == &relation_store.name;
|
|
|
|
|
|
|
|
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
@ -546,9 +552,9 @@ impl<'a> SessionTx<'a> {
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
)?;
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
|
|
let need_to_collect = !relation_store.is_temp
|
|
|
|
let need_to_collect = !force_collect.is_empty() || (!relation_store.is_temp
|
|
|
|
&& (is_callback_target
|
|
|
|
&& (is_callback_target
|
|
|
|
|| (propagate_triggers && !relation_store.put_triggers.is_empty()));
|
|
|
|
|| (propagate_triggers && !relation_store.put_triggers.is_empty())));
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
@ -794,7 +800,7 @@ impl<'a> SessionTx<'a> {
|
|
|
|
res_iter: impl Iterator<Item=Tuple>,
|
|
|
|
res_iter: impl Iterator<Item=Tuple>,
|
|
|
|
headers: &[Symbol],
|
|
|
|
headers: &[Symbol],
|
|
|
|
cur_vld: ValidityTs,
|
|
|
|
cur_vld: ValidityTs,
|
|
|
|
relation_store: &mut RelationHandle,
|
|
|
|
relation_store: &RelationHandle,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
span: SourceSpan,
|
|
|
|
span: SourceSpan,
|
|
|
@ -841,7 +847,7 @@ impl<'a> SessionTx<'a> {
|
|
|
|
res_iter: impl Iterator<Item=Tuple>,
|
|
|
|
res_iter: impl Iterator<Item=Tuple>,
|
|
|
|
headers: &[Symbol],
|
|
|
|
headers: &[Symbol],
|
|
|
|
cur_vld: ValidityTs,
|
|
|
|
cur_vld: ValidityTs,
|
|
|
|
relation_store: &mut RelationHandle,
|
|
|
|
relation_store: &RelationHandle,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
span: SourceSpan,
|
|
|
|
span: SourceSpan,
|
|
|
@ -915,13 +921,14 @@ impl<'a> SessionTx<'a> {
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
callback_collector: &mut CallbackCollector,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
propagate_triggers: bool,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
to_clear: &mut Vec<(Vec<u8>, Vec<u8>)>,
|
|
|
|
relation_store: &mut RelationHandle,
|
|
|
|
relation_store: &RelationHandle,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
metadata: &StoredRelationMetadata,
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
key_bindings: &[Symbol],
|
|
|
|
check_exists: bool,
|
|
|
|
check_exists: bool,
|
|
|
|
|
|
|
|
force_collect: &str,
|
|
|
|
span: SourceSpan,
|
|
|
|
span: SourceSpan,
|
|
|
|
) -> Result<()> {
|
|
|
|
) -> Result<()> {
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name);
|
|
|
|
let is_callback_target = callback_targets.contains(&relation_store.name) || force_collect == relation_store.name;
|
|
|
|
|
|
|
|
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
if relation_store.access_level < AccessLevel::Protected {
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
|
bail!(InsufficientAccessLevel(
|
|
|
@ -937,9 +944,9 @@ impl<'a> SessionTx<'a> {
|
|
|
|
headers,
|
|
|
|
headers,
|
|
|
|
)?;
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
|
|
let need_to_collect = !relation_store.is_temp
|
|
|
|
let need_to_collect = !force_collect.is_empty() || (!relation_store.is_temp
|
|
|
|
&& (is_callback_target
|
|
|
|
&& (is_callback_target
|
|
|
|
|| (propagate_triggers && !relation_store.rm_triggers.is_empty()));
|
|
|
|
|| (propagate_triggers && !relation_store.rm_triggers.is_empty())));
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_indices = !relation_store.indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_hnsw_indices = !relation_store.hnsw_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
|
let has_fts_indices = !relation_store.fts_indices.is_empty();
|
|
|
|