| 54 | } |
| 55 | |
| 56 | type Postgresql struct { |
| 57 | db *sql.DB |
| 58 | listener *pq.Listener |
| 59 | |
| 60 | leaderMu sync.Mutex |
| 61 | leaderID string |
| 62 | myID string |
| 63 | electPath string |
| 64 | isReady atomic.Bool |
| 65 | |
| 66 | quitCh chan struct{} |
| 67 | wg sync.WaitGroup |
| 68 | lockReleaseCh chan bool |
| 69 | leaderChangeCh chan bool |
| 70 | } |
| 71 | |
| 72 | func New(id string, cfg *Config) (*Postgresql, error) { |
| 73 | if len(id) == 0 { |
nothing calls this directly
no outgoing calls
no test coverage detected