Skip to content

Commit

Permalink
Fix duplicate UnmarshalJSON func for SyncData
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrks committed Jan 16, 2024
1 parent 2b2eacd commit ef6b46c
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions db/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,6 @@ type SyncData struct {
currentRevChannels base.Set // A base.Set of the current revision's channels (determined by SyncData.Channels at UnmarshalJSON time)
}

func (sd *SyncData) UnmarshalJSON(b []byte) error {

// type alias avoids UnmarshalJSON stack overflow (forces fallback to standard JSON unmarshal instead of this one)
type stdSyncData SyncData
var tmp stdSyncData

err := base.JSONUnmarshal(b, &tmp)
if err != nil {
return err
}

*sd = SyncData(tmp)

// determine current revision's channels and store in-memory (avoids Channels iteration at access-check time)
sd.currentRevChannels = sd.getCurrentChannels()

return nil
}

// determine set of current channels based on removal entries.
func (sd *SyncData) getCurrentChannels() base.Set {
ch := base.SetOf()
Expand Down

0 comments on commit ef6b46c

Please sign in to comment.