make jsonData public

This commit is contained in:
nytpu
2021-03-17 09:38:41 -06:00
parent e42ebd8171
commit 8426bb6494
+5 -5
View File
@@ -22,7 +22,7 @@ import (
// jsonData 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 JsonData struct {
Feeds map[url.URL]*Feed `json:"feeds,omitempty"`
Pages map[url.URL]*Page `json:"pages,omitempty"`
@@ -115,25 +115,25 @@ func (f *Feed) Swap(i, j int) {
// 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() {
func (j *JsonData) Lock() {
j.feedsMu.Lock()
j.pagesMu.Lock()
}
// Unlock unlocks both feed and page mutexes.
func (j *jsonData) Unlock() {
func (j *JsonData) Unlock() {
j.feedsMu.Unlock()
j.pagesMu.Unlock()
}
// RLock read-locks both feed and page mutexes.
func (j *jsonData) RLock() {
func (j *JsonData) RLock() {
j.feedsMu.RLock()
j.pagesMu.RLock()
}
// RUnlock read-unlocks both feed and page mutexes.
func (j *jsonData) RUnlock() {
func (j *JsonData) RUnlock() {
j.feedsMu.RUnlock()
j.pagesMu.RUnlock()
}