| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Package appcycle defines interfaces for managing application processes. |
| package appcycle |
| |
| // TODO(caprita): Implement AppCycle server in runtime. |
| |
| // Task is streamed by Stop to provide the client with a sense of the progress |
| // of the shutdown. |
| // The meaning of Progress and Goal are up to the developer (the server provides |
| // the framework with values for these). The recommended meanings are: |
| // - Progress: how far along the shutdown sequence the server is. This should |
| // be a monotonically increasing number. |
| // - Goal: when Progress reaches this value, the shutdown is expected to |
| // complete. This should not change during a stream, but could change if |
| // e.g. new shutdown tasks are triggered that were not forseen at the outset |
| // of the shutdown. |
| type Task struct { |
| Progress, Goal int32 |
| } |
| |
| // AppCycle interfaces with the process running a vanadium runtime. |
| type AppCycle interface{ |
| // Stop initiates shutdown of the server. It streams back periodic |
| // updates to give the client an idea of how the shutdown is |
| // progressing. |
| Stop() stream<_, Task> error |
| // ForceStop tells the server to shut down right away. It can be issued |
| // while a Stop is outstanding if for example the client does not want |
| // to wait any longer. |
| ForceStop() error |
| } |