mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
save work
This commit is contained in:
parent
fe3ffd1545
commit
523eafd85a
@ -126,4 +126,7 @@ type CleanableUpdateItem interface {
|
||||
func init() {
|
||||
// Register the model update packet type
|
||||
packet.RegisterPacketType(ModelUpdateStr, reflect.TypeOf(ModelUpdatePacketType{}))
|
||||
|
||||
// Enforce the UpdatePacket interface
|
||||
var _ UpdatePacket = (*ModelUpdatePacketType)(nil)
|
||||
}
|
||||
|
@ -47,4 +47,7 @@ func MakePtyDataUpdate(update *PtyDataUpdate) *PtyDataUpdatePacketType {
|
||||
func init() {
|
||||
// Register the PtyDataUpdatePacketType with the packet package
|
||||
packet.RegisterPacketType(PtyDataUpdateStr, reflect.TypeOf(PtyDataUpdatePacketType{}))
|
||||
|
||||
// Enforce the UpdatePacket interface
|
||||
var _ UpdatePacket = (*PtyDataUpdatePacketType)(nil)
|
||||
}
|
||||
|
@ -67,6 +67,9 @@ type UpdatePacket interface {
|
||||
IsEmpty() bool
|
||||
}
|
||||
|
||||
// Enforce that UpdatePacket is a packet.PacketType
|
||||
var _ packet.PacketType = (UpdatePacket)(nil)
|
||||
|
||||
// A channel for sending model updates to the client
|
||||
type UpdateChannel struct {
|
||||
ScreenId string
|
||||
@ -89,6 +92,9 @@ func (sch *UpdateChannel) Match(screenId string) bool {
|
||||
return screenId == sch.ScreenId
|
||||
}
|
||||
|
||||
// Enforce that UpdateChannel is a Channel
|
||||
var _ Channel[UpdatePacket] = (*UpdateChannel)(nil)
|
||||
|
||||
// A collection of channels that can transmit updates
|
||||
type UpdateBus struct {
|
||||
Bus[UpdatePacket]
|
||||
@ -206,6 +212,9 @@ func (ch *RpcChannel) Match(string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Enforce that RpcChannel is a Channel
|
||||
var _ Channel[RpcResponse] = (*RpcChannel)(nil)
|
||||
|
||||
// Send a user input request to the frontend and wait for a response
|
||||
func (bus *RpcBus) DoRpc(ctx context.Context, pk RpcPacket) (RpcResponse, error) {
|
||||
id := uuid.New().String()
|
||||
|
@ -74,4 +74,8 @@ func GetUserInput(ctx context.Context, bus *scbus.RpcBus, userInputRequest *User
|
||||
func init() {
|
||||
// Register the user input request packet type
|
||||
packet.RegisterPacketType(UserInputResponsePacketStr, reflect.TypeOf(UserInputResponsePacketType{}))
|
||||
|
||||
// Enforce the interfaces
|
||||
var _ scbus.RpcResponse = (*UserInputResponsePacketType)(nil)
|
||||
var _ scbus.RpcPacket = (*UserInputRequestType)(nil)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user