mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-31 01:24:31 +00:00
renaming of key related functions, updated doc
This commit is contained in:
parent
ca1ce3c534
commit
fb51f3947b
7 changed files with 18 additions and 20 deletions
4
TODO.md
4
TODO.md
|
@ -1,3 +1,7 @@
|
|||
# TODO
|
||||
|
||||
## Key and ACL updates to use jetstream
|
||||
|
||||
## tailfile
|
||||
|
||||
Replace the hpcloud/tail with <https://github.com/tenebris-tech/tail>
|
||||
|
|
|
@ -294,7 +294,7 @@ func (c *centralAuth) updateHash(proc process, message Message) {
|
|||
|
||||
b, err := cbor.Marshal(sortedNodesAndKeys)
|
||||
if err != nil {
|
||||
er := fmt.Errorf("error: methodKeysAllow, failed to marshal slice, and will not update hash for public keys: %v", err)
|
||||
er := fmt.Errorf("error: updateHash, failed to marshal slice, and will not update hash for public keys: %v", err)
|
||||
c.pki.errorKernel.errSend(proc, message, er, logError)
|
||||
|
||||
return
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
# Core ctrl
|
||||
|
||||
- [Messaging](./core_messaging_overview.md)
|
||||
- [Message fields](./core_messaging_message_fields.md)
|
||||
- [Message jetstream/broadcast](./core_messaging_jetstream.md)
|
||||
- [Request Methods](./core_request_methods.md)
|
||||
- [Message fields](./core_messaging_message_fields.md)
|
||||
- [Message jetstream/broadcast](./core_messaging_jetstream.md)
|
||||
- [Request Methods](./core_request_methods.md)
|
||||
- [{{CTRL_DATA}} variable](./core_messaging_CTRL_DATA.md)
|
||||
- [{{CTRL_FILE}} variable](./core_messaging_CTRL_FILE.md)
|
||||
- [Nats timeouts](./core_nats_timeouts.md)
|
||||
- [Startup folder](./core_startup_folder.md)
|
||||
- [{{CTRL_DATA}} variable](./core_messaging_CTRL_DATA.md)
|
||||
- [{{CTRL_FILE}} variable](./core_messaging_CTRL_FILE.md)
|
||||
- [Errors](./core_errors.md)
|
||||
- [central](./core_central.md)
|
||||
- [hello messages](./core_hello_messages.md)
|
||||
|
|
|
@ -112,7 +112,7 @@ func (p *processes) Start(proc process) {
|
|||
|
||||
if proc.configuration.StartProcesses.StartSubHello {
|
||||
|
||||
proc.startup.startProcess(proc, Hello, procFuncHello)
|
||||
proc.startup.startProcess(proc, Hello, procFuncHelloSubscriber)
|
||||
}
|
||||
|
||||
if proc.configuration.StartProcesses.IsCentralErrorLogger {
|
||||
|
|
|
@ -198,7 +198,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
|
|||
TailFile: HandlerFunc(methodTailFile),
|
||||
PublicKey: HandlerFunc(methodPublicKey),
|
||||
KeysRequestUpdate: HandlerFunc(methodKeysRequestUpdate),
|
||||
KeysDeliverUpdate: HandlerFunc(methodKeysDeliverUpdate),
|
||||
KeysDeliverUpdate: HandlerFunc(methodKeysReceiveUpdate),
|
||||
KeysAllow: HandlerFunc(methodKeysAllow),
|
||||
KeysDelete: HandlerFunc(methodKeysDelete),
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ func procFuncKeysRequestUpdate(ctx context.Context, proc process, procFuncCh cha
|
|||
// ----
|
||||
|
||||
// Handler to receive the public keys from a central server.
|
||||
func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte, error) {
|
||||
func methodKeysReceiveUpdate(proc process, message Message, node string) ([]byte, error) {
|
||||
// Get a context with the timeout specified in message.MethodTimeout.
|
||||
|
||||
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
||||
|
@ -195,11 +195,11 @@ func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte
|
|||
|
||||
err := json.Unmarshal(message.Data, &keysAndHash)
|
||||
if err != nil {
|
||||
er := fmt.Errorf("error: REQKeysDeliverUpdate : json unmarshal failed: %v, message: %v", err, message)
|
||||
er := fmt.Errorf("error: methodKeysReceiveUpdate : json unmarshal failed: %v, message: %v", err, message)
|
||||
proc.errorKernel.errSend(proc, message, er, logWarning)
|
||||
}
|
||||
|
||||
er := fmt.Errorf("<---- REQKeysDeliverUpdate: after unmarshal, nodeAuth keysAndhash contains: %+v", keysAndHash)
|
||||
er := fmt.Errorf("<---- methodKeysReceiveUpdate: after unmarshal, nodeAuth keysAndhash contains: %+v", keysAndHash)
|
||||
proc.errorKernel.logDebug(er)
|
||||
|
||||
// If the received map was empty we also want to delete all the locally stored keys,
|
||||
|
@ -213,7 +213,7 @@ func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte
|
|||
proc.nodeAuth.publicKeys.mu.Unlock()
|
||||
|
||||
if err != nil {
|
||||
er := fmt.Errorf("error: REQKeysDeliverUpdate : json unmarshal failed: %v, message: %v", err, message)
|
||||
er := fmt.Errorf("error: methodKeysReceiveUpdate : json unmarshal failed: %v, message: %v", err, message)
|
||||
proc.errorKernel.errSend(proc, message, er, logWarning)
|
||||
}
|
||||
|
||||
|
@ -222,18 +222,12 @@ func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte
|
|||
|
||||
err = proc.nodeAuth.publicKeys.saveToFile()
|
||||
if err != nil {
|
||||
er := fmt.Errorf("error: REQKeysDeliverUpdate : save to file failed: %v, message: %v", err, message)
|
||||
er := fmt.Errorf("error: methodKeysReceiveUpdate : save to file failed: %v, message: %v", err, message)
|
||||
proc.errorKernel.errSend(proc, message, er, logWarning)
|
||||
}
|
||||
|
||||
// Prepare and queue for sending a new message with the output
|
||||
// of the action executed.
|
||||
// newReplyMessage(proc, message, out)
|
||||
}
|
||||
}()
|
||||
|
||||
// Send back an ACK message.
|
||||
// ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ func methodHello(proc process, message Message, node string) ([]byte, error) {
|
|||
// received, the handler will deliver the message to the procFunc on the
|
||||
// proc.procFuncCh, and we can then read that message from the procFuncCh in
|
||||
// the procFunc running.
|
||||
func procFuncHello(ctx context.Context, proc process, procFuncCh chan Message) error {
|
||||
func procFuncHelloSubscriber(ctx context.Context, proc process, procFuncCh chan Message) error {
|
||||
// sayHelloNodes := make(map[Node]struct{})
|
||||
|
||||
for {
|
||||
|
|
Loading…
Add table
Reference in a new issue