19 lines
580 B
Go
19 lines
580 B
Go
|
package plans
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
// ChangesSync is a wrapper around a Changes that provides a concurrency-safe
|
||
|
// interface to insert new changes and retrieve copies of existing changes.
|
||
|
//
|
||
|
// Each ChangesSync is independent of all others, so all concurrent writers
|
||
|
// to a particular Changes must share a single ChangesSync. Behavior is
|
||
|
// undefined if any other caller makes changes to the underlying Changes
|
||
|
// object or its nested objects concurrently with any of the methods of a
|
||
|
// particular ChangesSync.
|
||
|
type ChangesSync struct {
|
||
|
lock sync.Mutex
|
||
|
changes *Changes
|
||
|
}
|