tangled
alpha
login
or
join now
atscan.net
/
plcbundle-go
1
fork
atom
[DEPRECATED] Go implementation of plcbundle
1
fork
atom
overview
issues
pulls
pipelines
index mutex protection
tree.fail
4 months ago
23cb86b8
92d8d34e
+11
2 changed files
expand all
collapse all
unified
split
bundle
did_index.go
did_index_builder.go
+5
bundle/did_index.go
···
44
44
config *DIDIndexConfig
45
45
logger Logger
46
46
verbose bool
47
47
+
48
48
+
indexMu sync.RWMutex
47
49
}
48
50
49
51
// mmapShard represents a memory-mapped shard file
···
124
126
125
127
// GetDIDLocations returns all bundle+position locations for a DID
126
128
func (dim *DIDIndexManager) GetDIDLocations(did string) ([]OpLocation, error) {
129
129
+
dim.indexMu.RLock()
130
130
+
defer dim.indexMu.RUnlock()
131
131
+
127
132
// Validate and extract identifier
128
133
identifier, err := extractDIDIdentifier(did)
129
134
if err != nil {
+6
bundle/did_index_builder.go
···
41
41
42
42
// BuildIndexFromScratch builds index with controlled memory usage
43
43
func (dim *DIDIndexManager) BuildIndexFromScratch(ctx context.Context, mgr *Manager, progressCallback func(current, total int)) error {
44
44
+
dim.indexMu.RLock()
45
45
+
defer dim.indexMu.RUnlock()
46
46
+
44
47
dim.logger.Printf("Building DID index from scratch (memory-efficient mode)...")
45
48
46
49
bundles := mgr.index.GetBundles()
···
224
227
225
228
// UpdateIndexForBundle adds operations from a new bundle (incremental + ATOMIC)
226
229
func (dim *DIDIndexManager) UpdateIndexForBundle(ctx context.Context, bundle *Bundle) error {
230
230
+
dim.indexMu.RLock()
231
231
+
defer dim.indexMu.RUnlock()
232
232
+
227
233
// Group operations by shard
228
234
shardOps := make(map[uint8]map[string][]OpLocation)
229
235