summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-03-17 11:23:44 -0600
committernytpu <alex@nytpu.com>2021-03-17 11:24:24 -0600
commit593c1288bc2e775cc5d116cb861141b752119d56 (patch)
treece0057135388f250ec6089ec58bf9379dc9ba57b
parent8426bb6494b63c15258191590eb80e479fa50e3e (diff)
resolve XXX question introduced by e42ebd8
-rw-r--r--core/structs.go38
1 files changed, 5 insertions, 33 deletions
diff --git a/core/structs.go b/core/structs.go
index a111841..abebed0 100644
--- a/core/structs.go
+++ b/core/structs.go
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// For more license details, see LICENSE or <https://www.gnu.org/licenses/agpl-3.0.html>.
-// This file incorporates code from makeworlds's amfora:
+// This file incorporates code from makeworld's amfora:
// https://github.com/makeworld-the-better-one/amfora/blob/master/subscriptions/structs.go
// Original source is Copyright 2020 makeworld and is licensed under the
// terms of the GNU General Public License Version 3.0.
@@ -20,14 +20,14 @@ import (
"github.com/mmcdole/gofeed"
)
-// jsonData is used for both reading from json and for storing the global feeds
+// FullData is used for both reading from json and for storing the global feeds
// map. contains read mutexes so concurrency can be used.
-type JsonData struct {
+type FullData struct {
Feeds map[url.URL]*Feed `json:"feeds,omitempty"`
Pages map[url.URL]*Page `json:"pages,omitempty"`
- feedsMu *sync.RWMutex
- pagesMu *sync.RWMutex
+ FeedsMu *sync.RWMutex
+ PagesMu *sync.RWMutex
}
// Feed holds all the necessary fields when storing a feed
@@ -110,34 +110,6 @@ func (f *Feed) Swap(i, j int) {
f.Items[i], f.Items[j] = f.Items[j], f.Items[i]
}
-// XXX: do both feedsMu and pagesMu need to be (un)locked together or can they
-// be locked individually? they are in the same struct but they're different
-// elements so they shuld be able to be accessed at the same time, right?
-
-// Lock locks both feed and page mutexes.
-func (j *JsonData) Lock() {
- j.feedsMu.Lock()
- j.pagesMu.Lock()
-}
-
-// Unlock unlocks both feed and page mutexes.
-func (j *JsonData) Unlock() {
- j.feedsMu.Unlock()
- j.pagesMu.Unlock()
-}
-
-// RLock read-locks both feed and page mutexes.
-func (j *JsonData) RLock() {
- j.feedsMu.RLock()
- j.pagesMu.RLock()
-}
-
-// RUnlock read-unlocks both feed and page mutexes.
-func (j *JsonData) RUnlock() {
- j.feedsMu.RUnlock()
- j.pagesMu.RUnlock()
-}
-
// PageEntry is a single item on a subscriptions page. It is used for both feeds
// and pages.
type PageEntry struct {