Publish a module's ledger history and snapshots only on its own ledger connection, read from the runner's own secret ledgers and followed without a restart (issue 1966 T6)
This commit is contained in:
@@ -288,9 +288,20 @@ func (c *Conn) refused(err error) {
|
||||
})
|
||||
}
|
||||
|
||||
// Connect dials the bus as the credential's module. A module's subjects come from its credential,
|
||||
// never from its calls (ADR 0074).
|
||||
// Connect dials the bus as the credential's module and follows its membership. A module's subjects come from its
|
||||
// credential, never from its calls (ADR 0074).
|
||||
func Connect(cred Credential) (*Conn, error) {
|
||||
c, err := Dial(cred)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.Follow(cred.Module)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Dial dials the bus as the credential's module and follows nothing: a connection that only publishes for its module,
|
||||
// as a module's ledger connection does (novox/hq ADR 0597 §9).
|
||||
func Dial(cred Credential) (*Conn, error) {
|
||||
if cred.Module == "" {
|
||||
return nil, errors.New("a broker credential with no module: the runtime derives its subjects " +
|
||||
"from the account the mesh issued, and cannot guess which module it is")
|
||||
@@ -329,7 +340,6 @@ func Connect(cred Credential) (*Conn, error) {
|
||||
}
|
||||
c = &Conn{nc: nc, js: js, self: cred.Module, node: cred.Node, cred: cred,
|
||||
issued: map[string]*Membership{}, Logf: log.Printf, answering: map[string]*answered{}}
|
||||
c.Follow(cred.Module)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user