renamed noteCache into becca

This commit is contained in:
zadam
2021-04-16 23:00:08 +02:00
parent af5b1021c7
commit f7e86c5be0
36 changed files with 199 additions and 199 deletions

View File

@@ -1,6 +1,6 @@
"use strict";
const noteCacheService = require('../../services/note_cache/note_cache_service');
const beccaService = require('../../services/note_cache/note_cache_service');
const searchService = require('../../services/search/services/search.js');
const repository = require('../../services/repository');
const log = require('../../services/log');
@@ -58,8 +58,8 @@ function getRecentNotes(activeNoteId) {
return recentNotes.map(rn => {
const notePathArray = rn.notePath.split('/');
const noteTitle = noteCacheService.getNoteTitle(notePathArray[notePathArray.length - 1]);
const notePathTitle = noteCacheService.getNoteTitleForPath(notePathArray);
const noteTitle = beccaService.getNoteTitle(notePathArray[notePathArray.length - 1]);
const notePathTitle = beccaService.getNoteTitleForPath(notePathArray);
return {
notePath: rn.notePath,

View File

@@ -5,7 +5,7 @@ const utils = require('../../services/utils');
const entityChangesService = require('../../services/entity_changes.js');
const treeService = require('../../services/tree');
const noteService = require('../../services/notes');
const noteCache = require('../../services/note_cache/note_cache');
const becca = require('../../services/note_cache/note_cache');
const repository = require('../../services/repository');
const TaskContext = require('../../services/task_context');
@@ -137,7 +137,7 @@ function setExpanded(req) {
// we don't sync expanded label
// also this does not trigger updates to the frontend, this would trigger too many reloads
const branch = noteCache.branches[branchId];
const branch = becca.branches[branchId];
if (branch) {
branch.isExpanded = !!expanded;
@@ -166,7 +166,7 @@ function setExpandedForSubtree(req) {
sql.executeMany(`UPDATE branches SET isExpanded = ${expanded} WHERE branchId IN (???)`, branchIds);
for (const branchId of branchIds) {
const branch = noteCache.branches[branchId];
const branch = becca.branches[branchId];
if (branch) {
branch.isExpanded = !!expanded;

View File

@@ -7,7 +7,7 @@ const zipImportService = require('../../services/import/zip');
const singleImportService = require('../../services/import/single');
const cls = require('../../services/cls');
const path = require('path');
const noteCacheLoader = require('../../services/note_cache/note_cache_loader.js');
const beccaLoader = require('../../services/note_cache/note_cache_loader.js');
const log = require('../../services/log');
const TaskContext = require('../../services/task_context.js');
@@ -77,10 +77,10 @@ async function importToBranch(req) {
}), 1000);
}
// import has deactivated note events so note cache is not updated
// import has deactivated note events so becca is not updated
// instead we force it to reload (can be async)
noteCacheLoader.load();
beccaLoader.load();
return note;
}

View File

@@ -1,7 +1,7 @@
"use strict";
const repository = require('../../services/repository');
const noteCacheService = require('../../services/note_cache/note_cache_service');
const beccaService = require('../../services/note_cache/note_cache_service');
const protectedSessionService = require('../../services/protected_session');
const noteRevisionService = require('../../services/note_revisions');
const utils = require('../../services/utils');
@@ -121,7 +121,7 @@ function getEditedNotesOnDate(req) {
LIMIT 50`, {date: req.params.date + '%'});
for (const note of notes) {
const notePath = note.isDeleted ? null : noteCacheService.getNotePath(note.noteId);
const notePath = note.isDeleted ? null : beccaService.getNotePath(note.noteId);
note.notePath = notePath ? notePath.notePath : null;
}

View File

@@ -3,7 +3,7 @@
const sql = require('../../services/sql');
const protectedSessionService = require('../../services/protected_session');
const noteService = require('../../services/notes');
const noteCacheService = require('../../services/note_cache/note_cache_service');
const beccaService = require('../../services/note_cache/note_cache_service');
function getRecentChanges(req) {
const {ancestorNoteId} = req.params;
@@ -25,7 +25,7 @@ function getRecentChanges(req) {
JOIN notes USING(noteId)`);
for (const noteRevision of noteRevisions) {
if (noteCacheService.isInAncestor(noteRevision.noteId, ancestorNoteId)) {
if (beccaService.isInAncestor(noteRevision.noteId, ancestorNoteId)) {
recentChanges.push(noteRevision);
}
}
@@ -58,7 +58,7 @@ function getRecentChanges(req) {
WHERE notes.isDeleted = 1`);
for (const note of notes) {
if (noteCacheService.isInAncestor(note.noteId, ancestorNoteId)) {
if (beccaService.isInAncestor(note.noteId, ancestorNoteId)) {
recentChanges.push(note);
}
}

View File

@@ -1,5 +1,5 @@
const sql = require('../../services/sql');
const noteCache = require('../../services/note_cache/note_cache');
const becca = require('../../services/note_cache/note_cache');
function getNoteSize(req) {
const {noteId} = req.params;
@@ -23,7 +23,7 @@ function getNoteSize(req) {
function getSubtreeSize(req) {
const {noteId} = req.params;
const note = noteCache.notes[noteId];
const note = becca.notes[noteId];
if (!note) {
return [404, `Note ${noteId} was not found.`];

View File

@@ -1,6 +1,6 @@
"use strict";
const noteCache = require('../../services/note_cache/note_cache');
const becca = require('../../services/note_cache/note_cache');
const log = require('../../services/log');
function getNotesAndBranchesAndAttributes(noteIds) {
@@ -23,7 +23,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const childNote of note.children) {
const childBranch = noteCache.getBranch(childNote.noteId, note.noteId);
const childBranch = becca.getBranch(childNote.noteId, note.noteId);
collectedBranchIds.add(childBranch.branchId);
}
@@ -38,7 +38,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const noteId of noteIds) {
const note = noteCache.notes[noteId];
const note = becca.notes[noteId];
if (!note) {
continue;
@@ -50,7 +50,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
const notes = [];
for (const noteId of collectedNoteIds) {
const note = noteCache.notes[noteId];
const note = becca.notes[noteId];
notes.push({
noteId: note.noteId,
@@ -75,7 +75,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const branchId of collectedBranchIds) {
const branch = noteCache.branches[branchId];
const branch = becca.branches[branchId];
if (!branch) {
log.error(`Could not find branch for branchId=${branchId}`);
@@ -95,7 +95,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
const attributes = [];
for (const attributeId of collectedAttributeIds) {
const attribute = noteCache.attributes[attributeId];
const attribute = becca.attributes[attributeId];
attributes.push({
attributeId: attribute.attributeId,
@@ -127,7 +127,7 @@ function getTree(req) {
for (const childNote of parentNote.children) {
collectedNoteIds.add(childNote.noteId);
const childBranch = noteCache.getBranch(childNote.noteId, parentNote.noteId);
const childBranch = becca.getBranch(childNote.noteId, parentNote.noteId);
if (childBranch.isExpanded) {
collect(childBranch.childNote);
@@ -135,11 +135,11 @@ function getTree(req) {
}
}
if (!(subTreeNoteId in noteCache.notes)) {
if (!(subTreeNoteId in becca.notes)) {
return [404, `Note ${subTreeNoteId} not found in the cache`];
}
collect(noteCache.notes[subTreeNoteId]);
collect(becca.notes[subTreeNoteId]);
return getNotesAndBranchesAndAttributes(collectedNoteIds);
}