Skip to content

Commit

Permalink
Remove unused helper in ListManager.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Feb 14, 2024
1 parent 84f6525 commit 73e9aaf
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions lib/ListManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import assert from 'assert-plus';
import {generateLocalId} from './helpers.js';
import {IndexAllocationCache} from './IndexAllocationCache.js';
import {ListSource} from './ListSource.js';
import {v4 as uuid} from 'uuid';

/* Notes: The following notes explain the scaling design for assigning
status list (SL) indexes to VCs in a parallel fashion. This design
Expand Down Expand Up @@ -590,47 +589,6 @@ export class ListManager {
}
}

async _getIndexAssignmentDoc({
blockAssignmentDocId, blockIndex, slSequence
}) {
// get `edvClient` directly; do not use cache in `documentStore` to ensure
// latest docs are used
const {documentStore: {edvClient}} = this;

// try to find existing index assignment doc
const equals = {
'meta.blockAssignmentDocId': blockAssignmentDocId,
'meta.blockIndex': blockIndex
};

// Note: This implementation is notably different from the
// `_getListManagementDoc` because when duplicate or conflict errors arise,
// we want to throw them, not ignore and read.
const {documents} = await edvClient.find({equals, limit: 1});
if(documents.length === 0) {
const type = 'StatusListIndexAssignmentDocument';
let indexAssignmentDoc = {
id: await edvClient.generateId(),
content: {
id: `urn:uuid:${uuid()}`,
type,
slSequence,
nextLocalIndex: 0
},
meta: {
type,
blockAssignmentDocId,
blockIndex
}
};
indexAssignmentDoc = await edvClient.update({doc: indexAssignmentDoc});
return {indexAssignmentDoc};
} else {
const [indexAssignmentDoc] = documents;
return {indexAssignmentDoc};
}
}

async _init() {
const {documentStore: {edvClient}} = this;
edvClient.ensureIndex({
Expand Down

0 comments on commit 73e9aaf

Please sign in to comment.