github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/cclglue.go (about) 1 // Copyright 2014 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package kvserver 12 13 import ( 14 "context" 15 16 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval" 17 "github.com/cockroachdb/cockroach/pkg/roachpb" 18 "github.com/cockroachdb/errors" 19 ) 20 21 var importCmdFn ImportCmdFunc = func(context.Context, batcheval.CommandArgs) (*roachpb.ImportResponse, error) { 22 return &roachpb.ImportResponse{}, errors.Errorf("unimplemented command: %s", roachpb.Import) 23 } 24 25 // ImportCmdFunc is the type of the function that will be called as the 26 // implementation of the Import command. 27 type ImportCmdFunc func(context.Context, batcheval.CommandArgs) (*roachpb.ImportResponse, error) 28 29 // SetImportCmd allows setting the function that will be called as the 30 // implementation of the Import command. Only allowed to be called by Init. 31 func SetImportCmd(fn ImportCmdFunc) { 32 // This is safe if SetImportCmd is only called at init time. 33 importCmdFn = fn 34 }