mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
cleanup and comments
This commit is contained in:
parent
40a3dce93c
commit
af068e08e7
2 changed files with 13 additions and 16 deletions
5
field.go
5
field.go
|
|
@ -413,11 +413,10 @@ func (f *Field) AvailableShards() *roaring.Bitmap {
|
|||
return b
|
||||
}
|
||||
|
||||
// constainsShard is used for limiting unnecessary CreateShard broadcast
|
||||
func (f *Field) containsShard(shard uint64) bool {
|
||||
f.mu.RLock()
|
||||
defer f.mu.RUnlock()
|
||||
fmt.Println("CONTAINS SHARD:", shard, f.Name())
|
||||
fmt.Println(f.remoteAvailableShards)
|
||||
return f.remoteAvailableShards.Contains(shard)
|
||||
}
|
||||
|
||||
|
|
@ -1187,7 +1186,7 @@ func (f *Field) newView(path, name string) *view {
|
|||
view.rowAttrStore = f.rowAttrStore
|
||||
view.stats = f.Stats
|
||||
view.broadcaster = f.broadcaster
|
||||
view.shardPresent = f.containsShard
|
||||
view.remoteShardPresent = f.containsShard
|
||||
if f.snapshotQueue != nil {
|
||||
view.snapshotQueue = f.snapshotQueue
|
||||
}
|
||||
|
|
|
|||
24
view.go
24
view.go
|
|
@ -55,12 +55,12 @@ type view struct {
|
|||
// Fragments by shard.
|
||||
fragments map[uint64]*fragment
|
||||
|
||||
broadcaster broadcaster
|
||||
stats stats.StatsClient
|
||||
rowAttrStore AttrStore
|
||||
logger logger.Logger
|
||||
snapshotQueue snapshotQueue
|
||||
shardPresent func(uint64) bool
|
||||
broadcaster broadcaster
|
||||
stats stats.StatsClient
|
||||
rowAttrStore AttrStore
|
||||
logger logger.Logger
|
||||
snapshotQueue snapshotQueue
|
||||
remoteShardPresent func(uint64) bool
|
||||
}
|
||||
|
||||
// newView returns a new instance of View.
|
||||
|
|
@ -77,10 +77,10 @@ func newView(path, index, field, name string, fieldOptions FieldOptions) *view {
|
|||
|
||||
fragments: make(map[uint64]*fragment),
|
||||
|
||||
broadcaster: NopBroadcaster,
|
||||
stats: stats.NopStatsClient,
|
||||
logger: logger.NopLogger,
|
||||
shardPresent: func(uint64) bool { return false },
|
||||
broadcaster: NopBroadcaster,
|
||||
stats: stats.NopStatsClient,
|
||||
logger: logger.NopLogger,
|
||||
remoteShardPresent: func(uint64) bool { return false },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,11 +283,9 @@ func (v *view) CreateFragmentIfNotExists(shard uint64) (*fragment, error) {
|
|||
}
|
||||
|
||||
func (v *view) notifyIfNew(shard uint64) {
|
||||
fmt.Println("Present", shard)
|
||||
if v.shardPresent(shard) {
|
||||
if v.remoteShardPresent(shard) { //checks the fields remoteShards bitmap to see if broadcast needed
|
||||
return
|
||||
}
|
||||
fmt.Println("BROADCAST", shard)
|
||||
broadcastChan := make(chan struct{})
|
||||
|
||||
go func() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue