go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/dsmapper/default.go (about)

     1  // Copyright 2021 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package dsmapper
    16  
    17  import (
    18  	"context"
    19  )
    20  
    21  // Default is a controller initialized by the server module.
    22  var Default = Controller{}
    23  
    24  // RegisterFactory adds the given mapper factory to the internal registry.
    25  //
    26  // See Controller.RegisterFactory for details.
    27  func RegisterFactory(id ID, m Factory) {
    28  	Default.RegisterFactory(id, m)
    29  }
    30  
    31  // LaunchJob launches a new mapping job, returning its ID.
    32  //
    33  // See Controller.LaunchJob for details.
    34  func LaunchJob(ctx context.Context, j *JobConfig) (JobID, error) {
    35  	return Default.LaunchJob(ctx, j)
    36  }