github.com/ava-labs/avalanchego@v1.11.11/vms/rpcchainvm/gruntime/runtime_server.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package gruntime 5 6 import ( 7 "context" 8 9 "google.golang.org/protobuf/types/known/emptypb" 10 11 "github.com/ava-labs/avalanchego/vms/rpcchainvm/runtime" 12 13 pb "github.com/ava-labs/avalanchego/proto/pb/vm/runtime" 14 ) 15 16 var _ pb.RuntimeServer = (*Server)(nil) 17 18 // Server is a VM runtime initializer controlled by RPC. 19 type Server struct { 20 pb.UnsafeRuntimeServer 21 runtime runtime.Initializer 22 } 23 24 func NewServer(runtime runtime.Initializer) *Server { 25 return &Server{ 26 runtime: runtime, 27 } 28 } 29 30 func (s *Server) Initialize(ctx context.Context, req *pb.InitializeRequest) (*emptypb.Empty, error) { 31 return &emptypb.Empty{}, s.runtime.Initialize(ctx, uint(req.ProtocolVersion), req.Addr) 32 }