Start Synced folder service

This commit is contained in:
sophia 2021-10-07 14:09:26 -05:00 committed by Paul Hinze
parent db259a0ed1
commit 08d4438ae1
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 81 additions and 0 deletions

View File

@ -7,6 +7,8 @@ module VagrantPlugins
autoload :HostService, Vagrant.source_root.join("plugins/commands/serve/service/host_service").to_s
autoload :InternalService, Vagrant.source_root.join("plugins/commands/serve/service/internal_service").to_s
autoload :ProviderService, Vagrant.source_root.join("plugins/commands/serve/service/provider_service").to_s
autoload :SyncedFolderService, Vagrant.source_root.join("plugins/commands/serve/service/synced_folder_service").to_s
class ServiceInfo
# @return [String] Name of requested plugin

View File

@ -0,0 +1,79 @@
require 'google/protobuf/well_known_types'
module VagrantPlugins
module CommandServe
module Service
class SyncedFolderService < SDK::SyncedFolderService::Service
include CapabilityPlatformService
def initialize(*args, **opts, &block)
caps = Vagrant.plugin("2").manager.synced_folder_capabilities
default_args = [
# Always get a target to pass the synced folder capability
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Target",
name: "",
),
]
initialize_capability_platform!(caps, default_args)
end
def usable_spec(*_)
SDK::FuncSpec.new(
name: "usable_spec",
args: [
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Target.Machine",
name: "",
)
],
result: [
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.SyncedFolder.UsableResp",
name: "",
),
],
)
end
def usable(req, ctx)
with_info(ctx) do |info|
# TODO
end
end
def enable_spec(*_)
SDK::FuncSpec.new(
name: "enable_spec",
args: [
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.Target.Machine",
name: "",
),
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.Args.OptionsHash",
name: "",
),
#TODO
],
result: [
SDK::FuncSpec::Value.new(
type: "hashicorp.vagrant.sdk.SyncedFolder.UsableResp",
name: "",
),
],
)
end
def enable(req, ctx)
with_info(ctx) do |info|
# TODO
end
end
end
end
end
end