mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
more read-only locking for maxslice, timequantum, and Index.Frames
This commit is contained in:
parent
c5b6c39c56
commit
3aecb61285
3 changed files with 14 additions and 14 deletions
8
frame.go
8
frame.go
|
|
@ -113,8 +113,8 @@ func (f *Frame) RowAttrStore() *AttrStore { return f.rowAttrStore }
|
|||
|
||||
// MaxSlice returns the max slice in the frame.
|
||||
func (f *Frame) MaxSlice() uint64 {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.mu.RLock()
|
||||
defer f.mu.RUnlock()
|
||||
|
||||
var max uint64
|
||||
for _, view := range f.views {
|
||||
|
|
@ -129,8 +129,8 @@ func (f *Frame) MaxSlice() uint64 {
|
|||
|
||||
// MaxInverseSlice returns the max inverse slice in the frame.
|
||||
func (f *Frame) MaxInverseSlice() uint64 {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.mu.RLock()
|
||||
defer f.mu.RUnlock()
|
||||
|
||||
view := f.views[ViewInverse]
|
||||
if view == nil {
|
||||
|
|
|
|||
16
index.go
16
index.go
|
|
@ -276,8 +276,8 @@ func (i *Index) MaxSlice() uint64 {
|
|||
if i == nil {
|
||||
return 0
|
||||
}
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
|
||||
max := i.remoteMaxSlice
|
||||
for _, f := range i.frames {
|
||||
|
|
@ -302,8 +302,8 @@ func (i *Index) MaxInverseSlice() uint64 {
|
|||
if i == nil {
|
||||
return 0
|
||||
}
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
|
||||
max := i.remoteMaxInverseSlice
|
||||
for _, f := range i.frames {
|
||||
|
|
@ -323,8 +323,8 @@ func (i *Index) SetRemoteMaxInverseSlice(v uint64) {
|
|||
|
||||
// TimeQuantum returns the default time quantum for the index.
|
||||
func (i *Index) TimeQuantum() TimeQuantum {
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
return i.timeQuantum
|
||||
}
|
||||
|
||||
|
|
@ -380,8 +380,8 @@ func (i *Index) inputDefinition(name string) *InputDefinition { return i.inputDe
|
|||
|
||||
// Frames returns a list of all frames in the index.
|
||||
func (i *Index) Frames() []*Frame {
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
|
||||
a := make([]*Frame, 0, len(i.frames))
|
||||
for _, f := range i.frames {
|
||||
|
|
|
|||
4
view.go
4
view.go
|
|
@ -174,8 +174,8 @@ func (v *View) Close() error {
|
|||
|
||||
// MaxSlice returns the max slice in the view.
|
||||
func (v *View) MaxSlice() uint64 {
|
||||
v.mu.Lock()
|
||||
defer v.mu.Unlock()
|
||||
v.mu.RLock()
|
||||
defer v.mu.RUnlock()
|
||||
|
||||
var max uint64
|
||||
for slice := range v.fragments {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue