make jsonData public
This commit is contained in:
+5
-5
@@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// jsonData is used for both reading from json and for storing the global feeds
|
// jsonData is used for both reading from json and for storing the global feeds
|
||||||
// map. contains read mutexes so concurrency can be used.
|
// map. contains read mutexes so concurrency can be used.
|
||||||
type jsonData struct {
|
type JsonData struct {
|
||||||
Feeds map[url.URL]*Feed `json:"feeds,omitempty"`
|
Feeds map[url.URL]*Feed `json:"feeds,omitempty"`
|
||||||
Pages map[url.URL]*Page `json:"pages,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?
|
// elements so they shuld be able to be accessed at the same time, right?
|
||||||
|
|
||||||
// Lock locks both feed and page mutexes.
|
// Lock locks both feed and page mutexes.
|
||||||
func (j *jsonData) Lock() {
|
func (j *JsonData) Lock() {
|
||||||
j.feedsMu.Lock()
|
j.feedsMu.Lock()
|
||||||
j.pagesMu.Lock()
|
j.pagesMu.Lock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlock unlocks both feed and page mutexes.
|
// Unlock unlocks both feed and page mutexes.
|
||||||
func (j *jsonData) Unlock() {
|
func (j *JsonData) Unlock() {
|
||||||
j.feedsMu.Unlock()
|
j.feedsMu.Unlock()
|
||||||
j.pagesMu.Unlock()
|
j.pagesMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RLock read-locks both feed and page mutexes.
|
// RLock read-locks both feed and page mutexes.
|
||||||
func (j *jsonData) RLock() {
|
func (j *JsonData) RLock() {
|
||||||
j.feedsMu.RLock()
|
j.feedsMu.RLock()
|
||||||
j.pagesMu.RLock()
|
j.pagesMu.RLock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RUnlock read-unlocks both feed and page mutexes.
|
// RUnlock read-unlocks both feed and page mutexes.
|
||||||
func (j *jsonData) RUnlock() {
|
func (j *JsonData) RUnlock() {
|
||||||
j.feedsMu.RUnlock()
|
j.feedsMu.RUnlock()
|
||||||
j.pagesMu.RUnlock()
|
j.pagesMu.RUnlock()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user