Movatterモバイル変換


[0]ホーム

URL:


agentapi

package
v2.29.1Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2025 License:AGPL-3.0Imports:50Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcWatchWorkspaceAgentMetadataChannel

func WatchWorkspaceAgentMetadataChannel(iduuid.UUID)string

funcWithAPIVersionadded inv2.8.0

func WithAPIVersion(ctxcontext.Context, versionstring)context.Context

Types

typeAPI

API implements the DRPC agent API interface from agent/proto. This struct isinstantiated once per agent connection and kept alive for the duration of thesession.

funcNew

func New(optsOptions, workspacedatabase.Workspace) *API

func (*API)Serve

func (a *API) Serve(ctxcontext.Context, lnet.Listener)error

func (*API)Server

func (a *API) Server(ctxcontext.Context) (*drpcserver.Server,error)

typeAnnouncementBannerAPIadded inv2.12.0

type AnnouncementBannerAPI struct {// contains filtered or unexported fields}

func (*AnnouncementBannerAPI)GetAnnouncementBannersadded inv2.12.0

func (*AnnouncementBannerAPI)GetServiceBannerdeprecatedadded inv2.12.0

Deprecated: GetServiceBanner has been deprecated in favor of GetAnnouncementBanners.

typeCachedWorkspaceFieldsadded inv2.29.0

type CachedWorkspaceFields struct {// contains filtered or unexported fields}

CachedWorkspaceFields contains workspace data that is safe to cache for theduration of an agent connection. These fields are used to reduce database callsin high-frequency operations like stats reporting and metadata updates.Prebuild workspaces should not be cached using this struct within the API struct,however some of these fields for a workspace can be updated live so there is aroutine in the API for refreshing the workspace on a timed interval.

IMPORTANT: ACL fields (GroupACL, UserACL) are NOT cached because they can bemodified in the database and we must use fresh data for authorization checks.

func (*CachedWorkspaceFields)AsWorkspaceIdentityadded inv2.29.0

func (cws *CachedWorkspaceFields) AsWorkspaceIdentity() (database.WorkspaceIdentity,bool)

Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild).

func (*CachedWorkspaceFields)Clearadded inv2.29.0

func (cws *CachedWorkspaceFields) Clear()

func (*CachedWorkspaceFields)UpdateValuesadded inv2.29.0

func (cws *CachedWorkspaceFields) UpdateValues(wsdatabase.Workspace)

typeConnLogAPIadded inv2.25.0

type ConnLogAPI struct {AgentFn          func(context.Context) (database.WorkspaceAgent,error)ConnectionLogger *atomic.Pointer[connectionlog.ConnectionLogger]Databasedatabase.StoreLogslog.Logger}

func (*ConnLogAPI)ReportConnectionadded inv2.25.0

typeLifecycleAPI

type LifecycleAPI struct {AgentFn                  func(context.Context) (database.WorkspaceAgent,error)WorkspaceIDuuid.UUIDDatabasedatabase.StoreLogslog.LoggerPublishWorkspaceUpdateFn func(context.Context, *database.WorkspaceAgent,wspubsub.WorkspaceEventKind)errorTimeNowFn func()time.Time// defaults to dbtime.Now()}

func (*LifecycleAPI)UpdateLifecycle

func (*LifecycleAPI)UpdateStartup

typeLogsAPI

type LogsAPI struct {AgentFn                           func(context.Context) (database.WorkspaceAgent,error)Databasedatabase.StoreLogslog.LoggerPublishWorkspaceUpdateFn          func(context.Context, *database.WorkspaceAgent,wspubsub.WorkspaceEventKind)errorPublishWorkspaceAgentLogsUpdateFn func(ctxcontext.Context, workspaceAgentIDuuid.UUID, msgagentsdk.LogsNotifyMessage)TimeNowFn func()time.Time// defaults to dbtime.Now()}

typeManifestAPI

type ManifestAPI struct {AccessURL                *url.URLAppHostnamestringExternalAuthConfigs      []*externalauth.ConfigDisableDirectConnectionsboolDerpForceWebSocketsboolWorkspaceIDuuid.UUIDAgentFn   func(context.Context) (database.WorkspaceAgent,error)Databasedatabase.StoreDerpMapFn func() *tailcfg.DERPMap}

typeMetadataAPI

type MetadataAPI struct {AgentFn   func(context.Context) (database.WorkspaceAgent,error)Workspace *CachedWorkspaceFieldsDatabasedatabase.StorePubsubpubsub.PubsubLogslog.LoggerTimeNowFn func()time.Time// defaults to dbtime.Now()}

typeOptions

type Options struct {AgentIDuuid.UUIDOwnerIDuuid.UUIDWorkspaceIDuuid.UUIDOrganizationIDuuid.UUIDAuthenticatedCtxcontext.ContextLogslog.LoggerClockquartz.ClockDatabasedatabase.StoreNotificationsEnqueuernotifications.EnqueuerPubsubpubsub.PubsubConnectionLogger                  *atomic.Pointer[connectionlog.ConnectionLogger]DerpMapFn                         func() *tailcfg.DERPMapTailnetCoordinator                *atomic.Pointer[tailnet.Coordinator]StatsReporter                     *workspacestats.ReporterAppearanceFetcher                 *atomic.Pointer[appearance.Fetcher]PublishWorkspaceUpdateFn          func(ctxcontext.Context, userIDuuid.UUID, eventwspubsub.WorkspaceEvent)PublishWorkspaceAgentLogsUpdateFn func(ctxcontext.Context, workspaceAgentIDuuid.UUID, msgagentsdk.LogsNotifyMessage)NetworkTelemetryHandler           func(batch []*tailnetproto.TelemetryEvent)AccessURL                 *url.URLAppHostnamestringAgentStatsRefreshIntervaltime.DurationDisableDirectConnectionsboolDerpForceWebSocketsboolDerpMapUpdateFrequencytime.DurationExternalAuthConfigs       []*externalauth.ConfigExperimentscodersdk.ExperimentsUpdateAgentMetricsFn func(ctxcontext.Context, labelsprometheusmetrics.AgentMetricLabels, metrics []*agentproto.Stats_Metric)}

typeResourcesMonitoringAPIadded inv2.20.0

type ResourcesMonitoringAPI struct {AgentIDuuid.UUIDWorkspaceIDuuid.UUIDLogslog.LoggerClockquartz.ClockDatabasedatabase.StoreNotificationsEnqueuernotifications.EnqueuerDebouncetime.DurationConfigresourcesmonitor.Config// contains filtered or unexported fields}

func (*ResourcesMonitoringAPI)InitMonitorsadded inv2.28.0

func (a *ResourcesMonitoringAPI) InitMonitors(ctxcontext.Context)error

InitMonitors fetches resource monitors from the database and caches them.This must be called once after creating a ResourcesMonitoringAPI, the context should bethe agent per-RPC connection context. If fetching fails with a real error (not sql.ErrNoRows), theconnection should be torn down.

func (*ResourcesMonitoringAPI)PushResourcesMonitoringUsageadded inv2.20.0

typeScriptsAPIadded inv2.16.0

type ScriptsAPI struct {Databasedatabase.Store}

typeStatsAPI

type StatsAPI struct {AgentFn                   func(context.Context) (database.WorkspaceAgent,error)Workspace                 *CachedWorkspaceFieldsDatabasedatabase.StoreLogslog.LoggerStatsReporter             *workspacestats.ReporterAgentStatsRefreshIntervaltime.DurationExperimentscodersdk.ExperimentsTimeNowFn func()time.Time// defaults to dbtime.Now()}

typeSubAgentAPIadded inv2.24.0

type SubAgentAPI struct {OwnerIDuuid.UUIDOrganizationIDuuid.UUIDAgentIDuuid.UUIDAgentFn        func(context.Context) (database.WorkspaceAgent,error)Logslog.LoggerClockquartz.ClockDatabasedatabase.Store}

func (*SubAgentAPI)CreateSubAgentadded inv2.24.0

func (*SubAgentAPI)DeleteSubAgentadded inv2.24.0

func (*SubAgentAPI)ListSubAgentsadded inv2.24.0

typeWorkspaceAgentMetadataChannelPayload

type WorkspaceAgentMetadataChannelPayload struct {CollectedAttime.Time `json:"collected_at"`Keys        []string  `json:"keys"`}

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp