File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 markOrphanedFiles ,
1010 buildPushContext ,
1111} from './helpers.js' ;
12- import { shouldShard , writeShardedCategory , writeInlineItemCategory } from './sharding.js' ;
12+ import { writeShardedCategory } from './sharding.js' ;
1313import {
1414 type ItemCategoryInfo ,
1515 type ItemInfo ,
@@ -169,14 +169,9 @@ function packItemCategoryData(
169169 ctx . files [ filename ] = { content : null } ;
170170 }
171171 const newItems = removeItemsById ( processed , tombResult . itemsToRemove ) ;
172- const totalEntries = Object . keys ( newItems ) . length + Object . keys ( tombResult . tombstones ) . length ;
173172
174- // Use sharding if item count exceeds threshold
175- if ( shouldShard ( totalEntries ) ) {
176- writeShardedCategory ( category , newItems , tombResult . tombstones , ctx ) ;
177- } else {
178- writeInlineItemCategory ( category , newItems , tombResult . tombstones , ctx ) ;
179- }
173+ // Always use sharding for item categories
174+ writeShardedCategory ( category , newItems , tombResult . tombstones , ctx ) ;
180175
181176 return filenames ;
182177}
Original file line number Diff line number Diff line change 66
77import { calculateChecksum } from '../packer.js' ;
88import {
9- type ItemCategoryInfo ,
109 type ItemInfo ,
1110 type CategoryShard ,
1211 type ShardedCategoryRef ,
1312 getShardFilename ,
14- shouldShard ,
1513} from '../../types/index.js' ;
1614import type { Tombstone } from '../../types/manifest.js' ;
1715import type { PushContext , SyncCategory } from './types.js' ;
1816
19- export { shouldShard } ;
20-
21- /** Write inline item category (not sharded) to manifest */
22- export function writeInlineItemCategory (
23- category : SyncCategory ,
24- items : Record < string , ItemInfo > ,
25- tombstones : Record < string , Tombstone > ,
26- ctx : PushContext
27- ) : void {
28- ctx . manifest . categories [ category ] = {
29- type : 'items' ,
30- items,
31- tombstones,
32- itemCount : Object . keys ( items ) . length ,
33- lastModified : ctx . now ,
34- lastModifiedBy : ctx . machineId ,
35- vectorClock : { [ ctx . machineId ] : ctx . newClock [ ctx . machineId ] ?? 1 } ,
36- } satisfies ItemCategoryInfo ;
37- }
38-
3917/**
4018 * Write a sharded category (items stored in separate shard file).
4119 */
Original file line number Diff line number Diff line change @@ -41,8 +41,6 @@ export {
4141 // Sharded manifest helpers
4242 isShardedRef ,
4343 getShardFilename ,
44- SHARDING_THRESHOLD ,
45- shouldShard ,
4644} from './manifest.js' ;
4745
4846// Sync Operations
Original file line number Diff line number Diff line change @@ -125,14 +125,6 @@ export function getShardFilename(category: SyncCategory): string {
125125 return `manifest-${ category } .json` ;
126126}
127127
128- /** Categories that should use sharding when item count exceeds threshold */
129- export const SHARDING_THRESHOLD = 100 ;
130-
131- /** Check if a category should be sharded based on item count */
132- export function shouldShard ( itemCount : number ) : boolean {
133- return itemCount >= SHARDING_THRESHOLD ;
134- }
135-
136128/** Content of a category shard file */
137129export interface CategoryShard {
138130 /** Category this shard belongs to */
You can’t perform that action at this time.
0 commit comments