id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
143,700 | Microsoft/hcsshim | internal/appargs/appargs.go | Rest | func Rest(v Validator) Validator {
return func(args []string) int {
count := len(args)
for len(args) != 0 {
n := v(args)
if n < 0 {
return n
}
args = args[n:]
}
return count
}
} | go | func Rest(v Validator) Validator {
return func(args []string) int {
count := len(args)
for len(args) != 0 {
n := v(args)
if n < 0 {
return n
}
args = args[n:]
}
return count
}
} | [
"func",
"Rest",
"(",
"v",
"Validator",
")",
"Validator",
"{",
"return",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"int",
"{",
"count",
":=",
"len",
"(",
"args",
")",
"\n",
"for",
"len",
"(",
"args",
")",
"!=",
"0",
"{",
"n",
":=",
"v",
"(",... | // Rest returns a validator that validates each of the remaining arguments. | [
"Rest",
"returns",
"a",
"validator",
"that",
"validates",
"each",
"of",
"the",
"remaining",
"arguments",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L57-L69 |
143,701 | Microsoft/hcsshim | internal/appargs/appargs.go | Validate | func Validate(vs ...Validator) cli.BeforeFunc {
return func(context *cli.Context) error {
remaining := context.Args()
for _, v := range vs {
consumed := v(remaining)
if consumed < 0 {
return ErrInvalidUsage
}
remaining = remaining[consumed:]
}
if len(remaining) > 0 {
return ErrInvalidUsage
... | go | func Validate(vs ...Validator) cli.BeforeFunc {
return func(context *cli.Context) error {
remaining := context.Args()
for _, v := range vs {
consumed := v(remaining)
if consumed < 0 {
return ErrInvalidUsage
}
remaining = remaining[consumed:]
}
if len(remaining) > 0 {
return ErrInvalidUsage
... | [
"func",
"Validate",
"(",
"vs",
"...",
"Validator",
")",
"cli",
".",
"BeforeFunc",
"{",
"return",
"func",
"(",
"context",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"remaining",
":=",
"context",
".",
"Args",
"(",
")",
"\n",
"for",
"_",
",",
"v",
... | // Validate can be used as a command's Before function to validate the arguments
// to the command. | [
"Validate",
"can",
"be",
"used",
"as",
"a",
"command",
"s",
"Before",
"function",
"to",
"validate",
"the",
"arguments",
"to",
"the",
"command",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L76-L93 |
143,702 | Microsoft/hcsshim | internal/wclayer/layerid.go | LayerID | func LayerID(path string) (guid.GUID, error) {
_, file := filepath.Split(path)
return NameToGuid(file)
} | go | func LayerID(path string) (guid.GUID, error) {
_, file := filepath.Split(path)
return NameToGuid(file)
} | [
"func",
"LayerID",
"(",
"path",
"string",
")",
"(",
"guid",
".",
"GUID",
",",
"error",
")",
"{",
"_",
",",
"file",
":=",
"filepath",
".",
"Split",
"(",
"path",
")",
"\n",
"return",
"NameToGuid",
"(",
"file",
")",
"\n",
"}"
] | // LayerID returns the layer ID of a layer on disk. | [
"LayerID",
"returns",
"the",
"layer",
"ID",
"of",
"a",
"layer",
"on",
"disk",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/layerid.go#L10-L13 |
143,703 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go | newWcowPodSandboxTask | func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM) shimTask {
logrus.WithFields(logrus.Fields{
"tid": id,
}).Debug("newWcowPodSandboxTask")
wpst := &wcowPodSandboxTask{
events: events,
id: id,
init: newWcowPodSandboxExec(ctx, events, id, bundle)... | go | func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM) shimTask {
logrus.WithFields(logrus.Fields{
"tid": id,
}).Debug("newWcowPodSandboxTask")
wpst := &wcowPodSandboxTask{
events: events,
id: id,
init: newWcowPodSandboxExec(ctx, events, id, bundle)... | [
"func",
"newWcowPodSandboxTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"events",
"publisher",
",",
"id",
",",
"bundle",
"string",
",",
"parent",
"*",
"uvm",
".",
"UtilityVM",
")",
"shimTask",
"{",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fie... | // newWcowPodSandboxTask creates a fake WCOW task with a fake WCOW `init`
// process as a performance optimization rather than creating an actual
// container and process since it is not needed to hold open any namespaces like
// the equivalent on Linux.
//
// It is assumed that this is the only fake WCOW task and that... | [
"newWcowPodSandboxTask",
"creates",
"a",
"fake",
"WCOW",
"task",
"with",
"a",
"fake",
"WCOW",
"init",
"process",
"as",
"a",
"performance",
"optimization",
"rather",
"than",
"creating",
"an",
"actual",
"container",
"and",
"process",
"since",
"it",
"is",
"not",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go#L28-L71 |
143,704 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go | close | func (wpst *wcowPodSandboxTask) close() {
wpst.closeOnce.Do(func() {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
}).Debug("wcowPodSandboxTask::close")
if wpst.host != nil {
if err := wpst.host.Close(); err != nil {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
logrus.ErrorK... | go | func (wpst *wcowPodSandboxTask) close() {
wpst.closeOnce.Do(func() {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
}).Debug("wcowPodSandboxTask::close")
if wpst.host != nil {
if err := wpst.host.Close(); err != nil {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
logrus.ErrorK... | [
"func",
"(",
"wpst",
"*",
"wcowPodSandboxTask",
")",
"close",
"(",
")",
"{",
"wpst",
".",
"closeOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"wpst",
".",
"id",
",",
... | // close safely closes the hosting UVM. Because of the specialty of this task it
// is assumed that this is always the owner of `wpst.host`. Once closed and all
// resources released it events the `runtime.TaskExitEventTopic` for all
// upstream listeners.
//
// This call is idempotent and safe to call multiple times. | [
"close",
"safely",
"closes",
"the",
"hosting",
"UVM",
".",
"Because",
"of",
"the",
"specialty",
"of",
"this",
"task",
"it",
"is",
"assumed",
"that",
"this",
"is",
"always",
"the",
"owner",
"of",
"wpst",
".",
"host",
".",
"Once",
"closed",
"and",
"all",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go#L205-L232 |
143,705 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_ps.go | Ps | func (r *Runhcs) Ps(context context.Context, id string) ([]int, error) {
data, err := cmdOutput(r.command(context, "ps", "--format=json", id), true)
if err != nil {
return nil, fmt.Errorf("%s: %s", err, data)
}
var out []int
if err := json.Unmarshal(data, &out); err != nil {
return nil, err
}
return out, nil... | go | func (r *Runhcs) Ps(context context.Context, id string) ([]int, error) {
data, err := cmdOutput(r.command(context, "ps", "--format=json", id), true)
if err != nil {
return nil, fmt.Errorf("%s: %s", err, data)
}
var out []int
if err := json.Unmarshal(data, &out); err != nil {
return nil, err
}
return out, nil... | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"Ps",
"(",
"context",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"cmdOutput",
"(",
"r",
".",
"command",
"(",
"context",
",",
... | // Ps displays the processes running inside a container. | [
"Ps",
"displays",
"the",
"processes",
"running",
"inside",
"a",
"container",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_ps.go#L10-L20 |
143,706 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | IsSupported | func IsSupported(sv *hcsschema.Version) error {
if IsV10(sv) {
return nil
}
if IsV21(sv) {
if osversion.Get().Build < osversion.RS5 {
return fmt.Errorf("unsupported on this Windows build")
}
return nil
}
return fmt.Errorf("unknown schema version %s", String(sv))
} | go | func IsSupported(sv *hcsschema.Version) error {
if IsV10(sv) {
return nil
}
if IsV21(sv) {
if osversion.Get().Build < osversion.RS5 {
return fmt.Errorf("unsupported on this Windows build")
}
return nil
}
return fmt.Errorf("unknown schema version %s", String(sv))
} | [
"func",
"IsSupported",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"error",
"{",
"if",
"IsV10",
"(",
"sv",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"IsV21",
"(",
"sv",
")",
"{",
"if",
"osversion",
".",
"Get",
"(",
")",
".",
"Build"... | // isSupported determines if a given schema version is supported | [
"isSupported",
"determines",
"if",
"a",
"given",
"schema",
"version",
"is",
"supported"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L25-L36 |
143,707 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | IsV10 | func IsV10(sv *hcsschema.Version) bool {
if sv.Major == 1 && sv.Minor == 0 {
return true
}
return false
} | go | func IsV10(sv *hcsschema.Version) bool {
if sv.Major == 1 && sv.Minor == 0 {
return true
}
return false
} | [
"func",
"IsV10",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"bool",
"{",
"if",
"sv",
".",
"Major",
"==",
"1",
"&&",
"sv",
".",
"Minor",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsV10 determines if a given schema version object is 1.0. This was the only thing
// supported in RS1..3. It lives on in RS5, but will be deprecated in a future release. | [
"IsV10",
"determines",
"if",
"a",
"given",
"schema",
"version",
"object",
"is",
"1",
".",
"0",
".",
"This",
"was",
"the",
"only",
"thing",
"supported",
"in",
"RS1",
"..",
"3",
".",
"It",
"lives",
"on",
"in",
"RS5",
"but",
"will",
"be",
"deprecated",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L40-L45 |
143,708 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | String | func String(sv *hcsschema.Version) string {
b, err := json.Marshal(sv)
if err != nil {
return ""
}
return string(b[:])
} | go | func String(sv *hcsschema.Version) string {
b, err := json.Marshal(sv)
if err != nil {
return ""
}
return string(b[:])
} | [
"func",
"String",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"string",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"sv",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"string",
"(",... | // String returns a JSON encoding of a schema version object | [
"String",
"returns",
"a",
"JSON",
"encoding",
"of",
"a",
"schema",
"version",
"object"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L58-L64 |
143,709 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | DetermineSchemaVersion | func DetermineSchemaVersion(requestedSV *hcsschema.Version) *hcsschema.Version {
sv := SchemaV10()
if osversion.Get().Build >= osversion.RS5 {
sv = SchemaV21()
}
if requestedSV != nil {
if err := IsSupported(requestedSV); err == nil {
sv = requestedSV
} else {
logrus.Warnf("Ignoring unsupported requeste... | go | func DetermineSchemaVersion(requestedSV *hcsschema.Version) *hcsschema.Version {
sv := SchemaV10()
if osversion.Get().Build >= osversion.RS5 {
sv = SchemaV21()
}
if requestedSV != nil {
if err := IsSupported(requestedSV); err == nil {
sv = requestedSV
} else {
logrus.Warnf("Ignoring unsupported requeste... | [
"func",
"DetermineSchemaVersion",
"(",
"requestedSV",
"*",
"hcsschema",
".",
"Version",
")",
"*",
"hcsschema",
".",
"Version",
"{",
"sv",
":=",
"SchemaV10",
"(",
")",
"\n",
"if",
"osversion",
".",
"Get",
"(",
")",
".",
"Build",
">=",
"osversion",
".",
"R... | // DetermineSchemaVersion works out what schema version to use based on build and
// requested option. | [
"DetermineSchemaVersion",
"works",
"out",
"what",
"schema",
"version",
"to",
"use",
"based",
"on",
"build",
"and",
"requested",
"option",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L68-L81 |
143,710 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_create-scratch.go | CreateScratch | func (r *Runhcs) CreateScratch(context context.Context, destpath string) error {
return r.runOrError(r.command(context, "create-scratch", "--destpath", destpath))
} | go | func (r *Runhcs) CreateScratch(context context.Context, destpath string) error {
return r.runOrError(r.command(context, "create-scratch", "--destpath", destpath))
} | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"CreateScratch",
"(",
"context",
"context",
".",
"Context",
",",
"destpath",
"string",
")",
"error",
"{",
"return",
"r",
".",
"runOrError",
"(",
"r",
".",
"command",
"(",
"context",
",",
"\"",
"\"",
",",
"\"",
"\... | // CreateScratch creates a scratch vhdx at 'destpath' that is ext4 formatted. | [
"CreateScratch",
"creates",
"a",
"scratch",
"vhdx",
"at",
"destpath",
"that",
"is",
"ext4",
"formatted",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_create-scratch.go#L8-L10 |
143,711 | Microsoft/hcsshim | internal/wclayer/importlayer.go | ImportLayer | func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
title := "hcsshim::ImportLayer"
fields := logrus.Fields{
"path": path,
"importFolderPath": importFolderPath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.Err... | go | func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
title := "hcsshim::ImportLayer"
fields := logrus.Fields{
"path": path,
"importFolderPath": importFolderPath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.Err... | [
"func",
"ImportLayer",
"(",
"path",
"string",
",",
"importFolderPath",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
... | // ImportLayer will take the contents of the folder at importFolderPath and import
// that into a layer with the id layerId. Note that in order to correctly populate
// the layer and interperet the transport format, all parent layers must already
// be present on the system at the paths provided in parentLayerPaths. | [
"ImportLayer",
"will",
"take",
"the",
"contents",
"of",
"the",
"folder",
"at",
"importFolderPath",
"and",
"import",
"that",
"into",
"a",
"layer",
"with",
"the",
"id",
"layerId",
".",
"Note",
"that",
"in",
"order",
"to",
"correctly",
"populate",
"the",
"layer... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/importlayer.go#L18-L45 |
143,712 | Microsoft/hcsshim | internal/wclayer/importlayer.go | NewLayerWriter | func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
if len(parentLayerPaths) == 0 {
// This is a base layer. It gets imported differently.
f, err := safefile.OpenRoot(path)
if err != nil {
return nil, err
}
return &baseLayerWriter{
root: f,
}, nil
}
importPath, err :... | go | func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
if len(parentLayerPaths) == 0 {
// This is a base layer. It gets imported differently.
f, err := safefile.OpenRoot(path)
if err != nil {
return nil, err
}
return &baseLayerWriter{
root: f,
}, nil
}
importPath, err :... | [
"func",
"NewLayerWriter",
"(",
"path",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"LayerWriter",
",",
"error",
")",
"{",
"if",
"len",
"(",
"parentLayerPaths",
")",
"==",
"0",
"{",
"// This is a base layer. It gets imported differently.",
"f",... | // NewLayerWriter returns a new layer writer for creating a layer on disk.
// The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges
// to call this and any methods on the resulting LayerWriter. | [
"NewLayerWriter",
"returns",
"a",
"new",
"layer",
"writer",
"for",
"creating",
"a",
"layer",
"on",
"disk",
".",
"The",
"caller",
"must",
"have",
"taken",
"the",
"SeBackupPrivilege",
"and",
"SeRestorePrivilege",
"privileges",
"to",
"call",
"this",
"and",
"any",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/importlayer.go#L110-L135 |
143,713 | Microsoft/hcsshim | internal/uvm/create_wcow.go | NewDefaultOptionsWCOW | func NewDefaultOptionsWCOW(id, owner string) *OptionsWCOW {
return &OptionsWCOW{
Options: newDefaultOptions(id, owner),
}
} | go | func NewDefaultOptionsWCOW(id, owner string) *OptionsWCOW {
return &OptionsWCOW{
Options: newDefaultOptions(id, owner),
}
} | [
"func",
"NewDefaultOptionsWCOW",
"(",
"id",
",",
"owner",
"string",
")",
"*",
"OptionsWCOW",
"{",
"return",
"&",
"OptionsWCOW",
"{",
"Options",
":",
"newDefaultOptions",
"(",
"id",
",",
"owner",
")",
",",
"}",
"\n",
"}"
] | // NewDefaultOptionsWCOW creates the default options for a bootable version of
// WCOW. The caller `MUST` set the `LayerFolders` path on the returned value.
//
// `id` the ID of the compute system. If not passed will generate a new GUID.
//
// `owner` the owner of the compute system. If not passed will use the
// execu... | [
"NewDefaultOptionsWCOW",
"creates",
"the",
"default",
"options",
"for",
"a",
"bootable",
"version",
"of",
"WCOW",
".",
"The",
"caller",
"MUST",
"set",
"the",
"LayerFolders",
"path",
"on",
"the",
"returned",
"value",
".",
"id",
"the",
"ID",
"of",
"the",
"comp... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create_wcow.go#L32-L36 |
143,714 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | Create | func (w *Writer) Create(name string, f *File) error {
if err := w.finishInode(); err != nil {
return err
}
dir, existing, childname, err := w.lookup(name, false)
if err != nil {
return err
}
var reuse *inode
if existing != nil {
if existing.IsDir() {
if f.Mode&TypeMask != S_IFDIR {
return fmt.Errorf... | go | func (w *Writer) Create(name string, f *File) error {
if err := w.finishInode(); err != nil {
return err
}
dir, existing, childname, err := w.lookup(name, false)
if err != nil {
return err
}
var reuse *inode
if existing != nil {
if existing.IsDir() {
if f.Mode&TypeMask != S_IFDIR {
return fmt.Errorf... | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Create",
"(",
"name",
"string",
",",
"f",
"*",
"File",
")",
"error",
"{",
"if",
"err",
":=",
"w",
".",
"finishInode",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"dir",
",",
... | // Create adds a file to the file system. | [
"Create",
"adds",
"a",
"file",
"to",
"the",
"file",
"system",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L518-L561 |
143,715 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | Link | func (w *Writer) Link(oldname, newname string) error {
if err := w.finishInode(); err != nil {
return err
}
newdir, existing, newchildname, err := w.lookup(newname, false)
if err != nil {
return err
}
if existing != nil && (existing.IsDir() || existing.LinkCount < 2) {
return fmt.Errorf("%s: cannot orphan e... | go | func (w *Writer) Link(oldname, newname string) error {
if err := w.finishInode(); err != nil {
return err
}
newdir, existing, newchildname, err := w.lookup(newname, false)
if err != nil {
return err
}
if existing != nil && (existing.IsDir() || existing.LinkCount < 2) {
return fmt.Errorf("%s: cannot orphan e... | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Link",
"(",
"oldname",
",",
"newname",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"w",
".",
"finishInode",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"newdir",
",",
"exist... | // Link adds a hard link to the file system. | [
"Link",
"adds",
"a",
"hard",
"link",
"to",
"the",
"file",
"system",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L564-L595 |
143,716 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | Stat | func (w *Writer) Stat(name string) (*File, error) {
if err := w.finishInode(); err != nil {
return nil, err
}
_, node, _, err := w.lookup(name, true)
if err != nil {
return nil, err
}
f := &File{
Size: node.Size,
Mode: node.Mode,
Uid: node.Uid,
Gid: node.Gid,
Atime: fsTimeToTime... | go | func (w *Writer) Stat(name string) (*File, error) {
if err := w.finishInode(); err != nil {
return nil, err
}
_, node, _, err := w.lookup(name, true)
if err != nil {
return nil, err
}
f := &File{
Size: node.Size,
Mode: node.Mode,
Uid: node.Uid,
Gid: node.Gid,
Atime: fsTimeToTime... | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Stat",
"(",
"name",
"string",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"if",
"err",
":=",
"w",
".",
"finishInode",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\... | // Stat returns information about a file that has been written. | [
"Stat",
"returns",
"information",
"about",
"a",
"file",
"that",
"has",
"been",
"written",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L598-L646 |
143,717 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | NewWriter | func NewWriter(f io.ReadWriteSeeker, opts ...Option) *Writer {
w := &Writer{
f: f,
bw: bufio.NewWriterSize(f, 65536*8),
maxDiskSize: defaultMaxDiskSize,
}
for _, opt := range opts {
opt(w)
}
return w
} | go | func NewWriter(f io.ReadWriteSeeker, opts ...Option) *Writer {
w := &Writer{
f: f,
bw: bufio.NewWriterSize(f, 65536*8),
maxDiskSize: defaultMaxDiskSize,
}
for _, opt := range opts {
opt(w)
}
return w
} | [
"func",
"NewWriter",
"(",
"f",
"io",
".",
"ReadWriteSeeker",
",",
"opts",
"...",
"Option",
")",
"*",
"Writer",
"{",
"w",
":=",
"&",
"Writer",
"{",
"f",
":",
"f",
",",
"bw",
":",
"bufio",
".",
"NewWriterSize",
"(",
"f",
",",
"65536",
"*",
"8",
")"... | // NewWriter returns a Writer that writes an ext4 file system to the provided
// WriteSeeker. | [
"NewWriter",
"returns",
"a",
"Writer",
"that",
"writes",
"an",
"ext4",
"file",
"system",
"to",
"the",
"provided",
"WriteSeeker",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L1021-L1031 |
143,718 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | MaximumDiskSize | func MaximumDiskSize(size int64) Option {
return func(w *Writer) {
if size < 0 || size > maxMaxDiskSize {
w.maxDiskSize = maxMaxDiskSize
} else if size == 0 {
w.maxDiskSize = defaultMaxDiskSize
} else {
w.maxDiskSize = (size + blockSize - 1) &^ (blockSize - 1)
}
}
} | go | func MaximumDiskSize(size int64) Option {
return func(w *Writer) {
if size < 0 || size > maxMaxDiskSize {
w.maxDiskSize = maxMaxDiskSize
} else if size == 0 {
w.maxDiskSize = defaultMaxDiskSize
} else {
w.maxDiskSize = (size + blockSize - 1) &^ (blockSize - 1)
}
}
} | [
"func",
"MaximumDiskSize",
"(",
"size",
"int64",
")",
"Option",
"{",
"return",
"func",
"(",
"w",
"*",
"Writer",
")",
"{",
"if",
"size",
"<",
"0",
"||",
"size",
">",
"maxMaxDiskSize",
"{",
"w",
".",
"maxDiskSize",
"=",
"maxMaxDiskSize",
"\n",
"}",
"else... | // MaximumDiskSize instructs the writer to reserve enough metadata space for the
// specified disk size. If not provided, then 16GB is the default. | [
"MaximumDiskSize",
"instructs",
"the",
"writer",
"to",
"reserve",
"enough",
"metadata",
"space",
"for",
"the",
"specified",
"disk",
"size",
".",
"If",
"not",
"provided",
"then",
"16GB",
"is",
"the",
"default",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L1045-L1055 |
143,719 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/service_internal.go | getPod | func (s *service) getPod() (shimPod, error) {
raw := s.taskOrPod.Load()
if raw == nil {
return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task with id: '%s' must be created first", s.tid)
}
return raw.(shimPod), nil
} | go | func (s *service) getPod() (shimPod, error) {
raw := s.taskOrPod.Load()
if raw == nil {
return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "task with id: '%s' must be created first", s.tid)
}
return raw.(shimPod), nil
} | [
"func",
"(",
"s",
"*",
"service",
")",
"getPod",
"(",
")",
"(",
"shimPod",
",",
"error",
")",
"{",
"raw",
":=",
"s",
".",
"taskOrPod",
".",
"Load",
"(",
")",
"\n",
"if",
"raw",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"("... | // getPod returns the pod this shim is tracking or else returns `nil`. It is the
// callers responsibility to verify that `s.isSandbox == true` before calling
// this method.
//
//
// If `pod==nil` returns `errdefs.ErrFailedPrecondition`. | [
"getPod",
"returns",
"the",
"pod",
"this",
"shim",
"is",
"tracking",
"or",
"else",
"returns",
"nil",
".",
"It",
"is",
"the",
"callers",
"responsibility",
"to",
"verify",
"that",
"s",
".",
"isSandbox",
"==",
"true",
"before",
"calling",
"this",
"method",
".... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/service_internal.go#L32-L38 |
143,720 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/service_internal.go | getTask | func (s *service) getTask(tid string) (shimTask, error) {
raw := s.taskOrPod.Load()
if raw == nil {
return nil, errors.Wrapf(errdefs.ErrNotFound, "task with id: '%s' not found", tid)
}
if s.isSandbox {
p := raw.(shimPod)
return p.GetTask(tid)
}
// When its not a sandbox only the init task is a valid id.
if... | go | func (s *service) getTask(tid string) (shimTask, error) {
raw := s.taskOrPod.Load()
if raw == nil {
return nil, errors.Wrapf(errdefs.ErrNotFound, "task with id: '%s' not found", tid)
}
if s.isSandbox {
p := raw.(shimPod)
return p.GetTask(tid)
}
// When its not a sandbox only the init task is a valid id.
if... | [
"func",
"(",
"s",
"*",
"service",
")",
"getTask",
"(",
"tid",
"string",
")",
"(",
"shimTask",
",",
"error",
")",
"{",
"raw",
":=",
"s",
".",
"taskOrPod",
".",
"Load",
"(",
")",
"\n",
"if",
"raw",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
... | // getTask returns a task matching `tid` or else returns `nil`. This properly
// handles a task in a pod or a singular task shim.
//
// If `tid` is not found will return `errdefs.ErrNotFound`. | [
"getTask",
"returns",
"a",
"task",
"matching",
"tid",
"or",
"else",
"returns",
"nil",
".",
"This",
"properly",
"handles",
"a",
"task",
"in",
"a",
"pod",
"or",
"a",
"singular",
"task",
"shim",
".",
"If",
"tid",
"is",
"not",
"found",
"will",
"return",
"e... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/service_internal.go#L44-L58 |
143,721 | Microsoft/hcsshim | internal/cni/registry.go | NewPersistedNamespaceConfig | func NewPersistedNamespaceConfig(namespaceID, containerID string, containerHostUniqueID guid.GUID) *PersistedNamespaceConfig {
return &PersistedNamespaceConfig{
namespaceID: namespaceID,
ContainerID: containerID,
HostUniqueID: containerHostUniqueID,
}
} | go | func NewPersistedNamespaceConfig(namespaceID, containerID string, containerHostUniqueID guid.GUID) *PersistedNamespaceConfig {
return &PersistedNamespaceConfig{
namespaceID: namespaceID,
ContainerID: containerID,
HostUniqueID: containerHostUniqueID,
}
} | [
"func",
"NewPersistedNamespaceConfig",
"(",
"namespaceID",
",",
"containerID",
"string",
",",
"containerHostUniqueID",
"guid",
".",
"GUID",
")",
"*",
"PersistedNamespaceConfig",
"{",
"return",
"&",
"PersistedNamespaceConfig",
"{",
"namespaceID",
":",
"namespaceID",
",",... | // NewPersistedNamespaceConfig creates an in-memory namespace config that can be
// persisted to the registry. | [
"NewPersistedNamespaceConfig",
"creates",
"an",
"in",
"-",
"memory",
"namespace",
"config",
"that",
"can",
"be",
"persisted",
"to",
"the",
"registry",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/cni/registry.go#L27-L33 |
143,722 | Microsoft/hcsshim | internal/cni/registry.go | LoadPersistedNamespaceConfig | func LoadPersistedNamespaceConfig(namespaceID string) (*PersistedNamespaceConfig, error) {
sk, err := regstate.Open(cniRoot, false)
if err != nil {
return nil, err
}
defer sk.Close()
pnc := PersistedNamespaceConfig{
namespaceID: namespaceID,
stored: true,
}
if err := sk.Get(namespaceID, cniKey, &pnc)... | go | func LoadPersistedNamespaceConfig(namespaceID string) (*PersistedNamespaceConfig, error) {
sk, err := regstate.Open(cniRoot, false)
if err != nil {
return nil, err
}
defer sk.Close()
pnc := PersistedNamespaceConfig{
namespaceID: namespaceID,
stored: true,
}
if err := sk.Get(namespaceID, cniKey, &pnc)... | [
"func",
"LoadPersistedNamespaceConfig",
"(",
"namespaceID",
"string",
")",
"(",
"*",
"PersistedNamespaceConfig",
",",
"error",
")",
"{",
"sk",
",",
"err",
":=",
"regstate",
".",
"Open",
"(",
"cniRoot",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // LoadPersistedNamespaceConfig loads a persisted config from the registry that matches
// `namespaceID`. If not found returns `regstate.NotFoundError` | [
"LoadPersistedNamespaceConfig",
"loads",
"a",
"persisted",
"config",
"from",
"the",
"registry",
"that",
"matches",
"namespaceID",
".",
"If",
"not",
"found",
"returns",
"regstate",
".",
"NotFoundError"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/cni/registry.go#L37-L52 |
143,723 | Microsoft/hcsshim | internal/cni/registry.go | Store | func (pnc *PersistedNamespaceConfig) Store() error {
if pnc.namespaceID == "" {
return errors.New("invalid namespaceID ''")
}
if pnc.ContainerID == "" {
return errors.New("invalid containerID ''")
}
empty := guid.GUID{}
if pnc.HostUniqueID == empty {
return errors.New("invalid containerHostUniqueID 'empy'")... | go | func (pnc *PersistedNamespaceConfig) Store() error {
if pnc.namespaceID == "" {
return errors.New("invalid namespaceID ''")
}
if pnc.ContainerID == "" {
return errors.New("invalid containerID ''")
}
empty := guid.GUID{}
if pnc.HostUniqueID == empty {
return errors.New("invalid containerHostUniqueID 'empy'")... | [
"func",
"(",
"pnc",
"*",
"PersistedNamespaceConfig",
")",
"Store",
"(",
")",
"error",
"{",
"if",
"pnc",
".",
"namespaceID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"pnc",
".",
"ContainerID",... | // Store stores or updates the in-memory config to its registry state. If the
// store failes returns the store error. | [
"Store",
"stores",
"or",
"updates",
"the",
"in",
"-",
"memory",
"config",
"to",
"its",
"registry",
"state",
".",
"If",
"the",
"store",
"failes",
"returns",
"the",
"store",
"error",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/cni/registry.go#L56-L84 |
143,724 | Microsoft/hcsshim | internal/cni/registry.go | Remove | func (pnc *PersistedNamespaceConfig) Remove() error {
if pnc.stored {
sk, err := regstate.Open(cniRoot, false)
if err != nil {
if regstate.IsNotFoundError(err) {
pnc.stored = false
return nil
}
return err
}
defer sk.Close()
if err := sk.Remove(pnc.namespaceID); err != nil {
if regstate.I... | go | func (pnc *PersistedNamespaceConfig) Remove() error {
if pnc.stored {
sk, err := regstate.Open(cniRoot, false)
if err != nil {
if regstate.IsNotFoundError(err) {
pnc.stored = false
return nil
}
return err
}
defer sk.Close()
if err := sk.Remove(pnc.namespaceID); err != nil {
if regstate.I... | [
"func",
"(",
"pnc",
"*",
"PersistedNamespaceConfig",
")",
"Remove",
"(",
")",
"error",
"{",
"if",
"pnc",
".",
"stored",
"{",
"sk",
",",
"err",
":=",
"regstate",
".",
"Open",
"(",
"cniRoot",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"i... | // Remove removes any persisted state associated with this config. If the config
// is not found in the registery `Remove` returns no error. | [
"Remove",
"removes",
"any",
"persisted",
"state",
"associated",
"with",
"this",
"config",
".",
"If",
"the",
"config",
"is",
"not",
"found",
"in",
"the",
"registery",
"Remove",
"returns",
"no",
"error",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/cni/registry.go#L88-L110 |
143,725 | Microsoft/hcsshim | internal/wclayer/destroylayer.go | DestroyLayer | func DestroyLayer(path string) (err error) {
title := "hcsshim::DestroyLayer"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields).Debug(tit... | go | func DestroyLayer(path string) (err error) {
title := "hcsshim::DestroyLayer"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields).Debug(tit... | [
"func",
"DestroyLayer",
"(",
"path",
"string",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"path",
",",
"}",
"\n",
"logrus",
".",
"WithFields",
"(",
"fields",
"... | // DestroyLayer will remove the on-disk files representing the layer with the given
// path, including that layer's containing folder, if any. | [
"DestroyLayer",
"will",
"remove",
"the",
"on",
"-",
"disk",
"files",
"representing",
"the",
"layer",
"with",
"the",
"given",
"path",
"including",
"that",
"layer",
"s",
"containing",
"folder",
"if",
"any",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/destroylayer.go#L10-L30 |
143,726 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_resize-tty.go | ResizeTTY | func (r *Runhcs) ResizeTTY(context context.Context, id string, width, height uint16, opts *ResizeTTYOpts) error {
args := []string{"resize-tty"}
if opts != nil {
oargs, err := opts.args()
if err != nil {
return err
}
args = append(args, oargs...)
}
return r.runOrError(r.command(context, append(args, id, ... | go | func (r *Runhcs) ResizeTTY(context context.Context, id string, width, height uint16, opts *ResizeTTYOpts) error {
args := []string{"resize-tty"}
if opts != nil {
oargs, err := opts.args()
if err != nil {
return err
}
args = append(args, oargs...)
}
return r.runOrError(r.command(context, append(args, id, ... | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"ResizeTTY",
"(",
"context",
"context",
".",
"Context",
",",
"id",
"string",
",",
"width",
",",
"height",
"uint16",
",",
"opts",
"*",
"ResizeTTYOpts",
")",
"error",
"{",
"args",
":=",
"[",
"]",
"string",
"{",
"\"... | // ResizeTTY updates the terminal size for a container process. | [
"ResizeTTY",
"updates",
"the",
"terminal",
"size",
"for",
"a",
"container",
"process",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_resize-tty.go#L23-L33 |
143,727 | Microsoft/hcsshim | internal/oci/sandbox.go | GetSandboxTypeAndID | func GetSandboxTypeAndID(specAnnotations map[string]string) (KubernetesContainerType, string, error) {
var ct KubernetesContainerType
if t, ok := specAnnotations[KubernetesContainerTypeAnnotation]; ok {
switch t {
case string(KubernetesContainerTypeContainer):
ct = KubernetesContainerTypeContainer
case strin... | go | func GetSandboxTypeAndID(specAnnotations map[string]string) (KubernetesContainerType, string, error) {
var ct KubernetesContainerType
if t, ok := specAnnotations[KubernetesContainerTypeAnnotation]; ok {
switch t {
case string(KubernetesContainerTypeContainer):
ct = KubernetesContainerTypeContainer
case strin... | [
"func",
"GetSandboxTypeAndID",
"(",
"specAnnotations",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"KubernetesContainerType",
",",
"string",
",",
"error",
")",
"{",
"var",
"ct",
"KubernetesContainerType",
"\n",
"if",
"t",
",",
"ok",
":=",
"specAnnotations",
... | // GetSandboxTypeAndID parses `specAnnotations` searching for the
// `KubernetesContainerTypeAnnotation` and `KubernetesSandboxIDAnnotation`
// annotations and if found validates the set before returning. | [
"GetSandboxTypeAndID",
"parses",
"specAnnotations",
"searching",
"for",
"the",
"KubernetesContainerTypeAnnotation",
"and",
"KubernetesSandboxIDAnnotation",
"annotations",
"and",
"if",
"found",
"validates",
"the",
"set",
"before",
"returning",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/sandbox.go#L33-L59 |
143,728 | Microsoft/hcsshim | internal/safefile/safeopen.go | openRelativeInternal | func openRelativeInternal(path string, root *os.File, accessMask uint32, shareFlags uint32, createDisposition uint32, flags uint32) (*os.File, error) {
var (
h uintptr
iosb ioStatusBlock
oa objectAttributes
)
path16, err := ntRelativePath(path)
if err != nil {
return nil, err
}
if root == nil || ro... | go | func openRelativeInternal(path string, root *os.File, accessMask uint32, shareFlags uint32, createDisposition uint32, flags uint32) (*os.File, error) {
var (
h uintptr
iosb ioStatusBlock
oa objectAttributes
)
path16, err := ntRelativePath(path)
if err != nil {
return nil, err
}
if root == nil || ro... | [
"func",
"openRelativeInternal",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
",",
"accessMask",
"uint32",
",",
"shareFlags",
"uint32",
",",
"createDisposition",
"uint32",
",",
"flags",
"uint32",
")",
"(",
"*",
"os",
".",
"File",
",",
"error"... | // openRelativeInternal opens a relative path from the given root, failing if
// any of the intermediate path components are reparse points. | [
"openRelativeInternal",
"opens",
"a",
"relative",
"path",
"from",
"the",
"given",
"root",
"failing",
"if",
"any",
"of",
"the",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L110-L163 |
143,729 | Microsoft/hcsshim | internal/safefile/safeopen.go | OpenRelative | func OpenRelative(path string, root *os.File, accessMask uint32, shareFlags uint32, createDisposition uint32, flags uint32) (*os.File, error) {
f, err := openRelativeInternal(path, root, accessMask, shareFlags, createDisposition, flags)
if err != nil {
err = &os.PathError{Op: "open", Path: filepath.Join(root.Name()... | go | func OpenRelative(path string, root *os.File, accessMask uint32, shareFlags uint32, createDisposition uint32, flags uint32) (*os.File, error) {
f, err := openRelativeInternal(path, root, accessMask, shareFlags, createDisposition, flags)
if err != nil {
err = &os.PathError{Op: "open", Path: filepath.Join(root.Name()... | [
"func",
"OpenRelative",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
",",
"accessMask",
"uint32",
",",
"shareFlags",
"uint32",
",",
"createDisposition",
"uint32",
",",
"flags",
"uint32",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",... | // OpenRelative opens a relative path from the given root, failing if
// any of the intermediate path components are reparse points. | [
"OpenRelative",
"opens",
"a",
"relative",
"path",
"from",
"the",
"given",
"root",
"failing",
"if",
"any",
"of",
"the",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L167-L173 |
143,730 | Microsoft/hcsshim | internal/safefile/safeopen.go | deleteOnClose | func deleteOnClose(f *os.File) error {
disposition := fileDispositionInformationEx{Flags: FILE_DISPOSITION_DELETE}
var iosb ioStatusBlock
status := ntSetInformationFile(
f.Fd(),
&iosb,
uintptr(unsafe.Pointer(&disposition)),
uint32(unsafe.Sizeof(disposition)),
_FileDispositionInformationEx,
)
if status !=... | go | func deleteOnClose(f *os.File) error {
disposition := fileDispositionInformationEx{Flags: FILE_DISPOSITION_DELETE}
var iosb ioStatusBlock
status := ntSetInformationFile(
f.Fd(),
&iosb,
uintptr(unsafe.Pointer(&disposition)),
uint32(unsafe.Sizeof(disposition)),
_FileDispositionInformationEx,
)
if status !=... | [
"func",
"deleteOnClose",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"disposition",
":=",
"fileDispositionInformationEx",
"{",
"Flags",
":",
"FILE_DISPOSITION_DELETE",
"}",
"\n",
"var",
"iosb",
"ioStatusBlock",
"\n",
"status",
":=",
"ntSetInformationFile"... | // deleteOnClose marks a file to be deleted when the handle is closed. | [
"deleteOnClose",
"marks",
"a",
"file",
"to",
"be",
"deleted",
"when",
"the",
"handle",
"is",
"closed",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L254-L268 |
143,731 | Microsoft/hcsshim | internal/safefile/safeopen.go | clearReadOnly | func clearReadOnly(f *os.File) error {
bi, err := winio.GetFileBasicInfo(f)
if err != nil {
return err
}
if bi.FileAttributes&syscall.FILE_ATTRIBUTE_READONLY == 0 {
return nil
}
sbi := winio.FileBasicInfo{
FileAttributes: bi.FileAttributes &^ syscall.FILE_ATTRIBUTE_READONLY,
}
if sbi.FileAttributes == 0 {... | go | func clearReadOnly(f *os.File) error {
bi, err := winio.GetFileBasicInfo(f)
if err != nil {
return err
}
if bi.FileAttributes&syscall.FILE_ATTRIBUTE_READONLY == 0 {
return nil
}
sbi := winio.FileBasicInfo{
FileAttributes: bi.FileAttributes &^ syscall.FILE_ATTRIBUTE_READONLY,
}
if sbi.FileAttributes == 0 {... | [
"func",
"clearReadOnly",
"(",
"f",
"*",
"os",
".",
"File",
")",
"error",
"{",
"bi",
",",
"err",
":=",
"winio",
".",
"GetFileBasicInfo",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"bi",
".",
"FileAt... | // clearReadOnly clears the readonly attribute on a file. | [
"clearReadOnly",
"clears",
"the",
"readonly",
"attribute",
"on",
"a",
"file",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L271-L286 |
143,732 | Microsoft/hcsshim | internal/safefile/safeopen.go | RemoveRelative | func RemoveRelative(path string, root *os.File) error {
f, err := openRelativeInternal(
path,
root,
FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES|DELETE,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT)
if err == nil {
defer f.Close()
err = d... | go | func RemoveRelative(path string, root *os.File) error {
f, err := openRelativeInternal(
path,
root,
FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES|DELETE,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT)
if err == nil {
defer f.Close()
err = d... | [
"func",
"RemoveRelative",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
")",
"error",
"{",
"f",
",",
"err",
":=",
"openRelativeInternal",
"(",
"path",
",",
"root",
",",
"FILE_READ_ATTRIBUTES",
"|",
"FILE_WRITE_ATTRIBUTES",
"|",
"DELETE",
",",
... | // RemoveRelative removes a file or directory relative to a root, failing if any
// intermediate path components are reparse points. | [
"RemoveRelative",
"removes",
"a",
"file",
"or",
"directory",
"relative",
"to",
"a",
"root",
"failing",
"if",
"any",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L290-L311 |
143,733 | Microsoft/hcsshim | internal/safefile/safeopen.go | RemoveAllRelative | func RemoveAllRelative(path string, root *os.File) error {
fi, err := LstatRelative(path, root)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
fileAttributes := fi.Sys().(*syscall.Win32FileAttributeData).FileAttributes
if fileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY == 0 || fileAttri... | go | func RemoveAllRelative(path string, root *os.File) error {
fi, err := LstatRelative(path, root)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
fileAttributes := fi.Sys().(*syscall.Win32FileAttributeData).FileAttributes
if fileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY == 0 || fileAttri... | [
"func",
"RemoveAllRelative",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
")",
"error",
"{",
"fi",
",",
"err",
":=",
"LstatRelative",
"(",
"path",
",",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
... | // RemoveAllRelative removes a directory tree relative to a root, failing if any
// intermediate path components are reparse points. | [
"RemoveAllRelative",
"removes",
"a",
"directory",
"tree",
"relative",
"to",
"a",
"root",
"failing",
"if",
"any",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L315-L378 |
143,734 | Microsoft/hcsshim | internal/safefile/safeopen.go | MkdirRelative | func MkdirRelative(path string, root *os.File) error {
f, err := openRelativeInternal(
path,
root,
0,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_CREATE,
FILE_DIRECTORY_FILE)
if err == nil {
f.Close()
} else {
err = &os.PathError{Op: "mkdir", Path: filepath.Join(r... | go | func MkdirRelative(path string, root *os.File) error {
f, err := openRelativeInternal(
path,
root,
0,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_CREATE,
FILE_DIRECTORY_FILE)
if err == nil {
f.Close()
} else {
err = &os.PathError{Op: "mkdir", Path: filepath.Join(r... | [
"func",
"MkdirRelative",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
")",
"error",
"{",
"f",
",",
"err",
":=",
"openRelativeInternal",
"(",
"path",
",",
"root",
",",
"0",
",",
"syscall",
".",
"FILE_SHARE_READ",
"|",
"syscall",
".",
"FIL... | // MkdirRelative creates a directory relative to a root, failing if any
// intermediate path components are reparse points. | [
"MkdirRelative",
"creates",
"a",
"directory",
"relative",
"to",
"a",
"root",
"failing",
"if",
"any",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L382-L396 |
143,735 | Microsoft/hcsshim | internal/safefile/safeopen.go | LstatRelative | func LstatRelative(path string, root *os.File) (os.FileInfo, error) {
f, err := openRelativeInternal(
path,
root,
FILE_READ_ATTRIBUTES,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT)
if err != nil {
return nil, &os.PathError{Op: "stat", Pa... | go | func LstatRelative(path string, root *os.File) (os.FileInfo, error) {
f, err := openRelativeInternal(
path,
root,
FILE_READ_ATTRIBUTES,
syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT)
if err != nil {
return nil, &os.PathError{Op: "stat", Pa... | [
"func",
"LstatRelative",
"(",
"path",
"string",
",",
"root",
"*",
"os",
".",
"File",
")",
"(",
"os",
".",
"FileInfo",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"openRelativeInternal",
"(",
"path",
",",
"root",
",",
"FILE_READ_ATTRIBUTES",
",",
"sy... | // LstatRelative performs a stat operation on a file relative to a root, failing
// if any intermediate path components are reparse points. | [
"LstatRelative",
"performs",
"a",
"stat",
"operation",
"on",
"a",
"file",
"relative",
"to",
"a",
"root",
"failing",
"if",
"any",
"intermediate",
"path",
"components",
"are",
"reparse",
"points",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/safefile/safeopen.go#L400-L413 |
143,736 | libopenstorage/openstorage | api/server/sdk/identity.go | Capabilities | func (s *IdentityServer) Capabilities(
ctx context.Context,
req *api.SdkIdentityCapabilitiesRequest,
) (*api.SdkIdentityCapabilitiesResponse, error) {
capCluster := &api.SdkServiceCapability{
Type: &api.SdkServiceCapability_Service{
Service: &api.SdkServiceCapability_OpenStorageService{
Type: api.SdkServic... | go | func (s *IdentityServer) Capabilities(
ctx context.Context,
req *api.SdkIdentityCapabilitiesRequest,
) (*api.SdkIdentityCapabilitiesResponse, error) {
capCluster := &api.SdkServiceCapability{
Type: &api.SdkServiceCapability_Service{
Service: &api.SdkServiceCapability_OpenStorageService{
Type: api.SdkServic... | [
"func",
"(",
"s",
"*",
"IdentityServer",
")",
"Capabilities",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkIdentityCapabilitiesRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkIdentityCapabilitiesResponse",
",",
"error",
")",
"{",
"ca... | // Capabilities returns the capabilities of the SDK server | [
"Capabilities",
"returns",
"the",
"capabilities",
"of",
"the",
"SDK",
"server"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/identity.go#L39-L152 |
143,737 | libopenstorage/openstorage | api/server/sdk/identity.go | Version | func (s *IdentityServer) Version(
ctx context.Context,
req *api.SdkIdentityVersionRequest,
) (*api.SdkIdentityVersionResponse, error) {
var (
version *api.StorageVersion
err error
)
if s.driver(ctx) == nil {
version = &api.StorageVersion{
Driver: "no driver running",
}
} else {
version, err = s.... | go | func (s *IdentityServer) Version(
ctx context.Context,
req *api.SdkIdentityVersionRequest,
) (*api.SdkIdentityVersionResponse, error) {
var (
version *api.StorageVersion
err error
)
if s.driver(ctx) == nil {
version = &api.StorageVersion{
Driver: "no driver running",
}
} else {
version, err = s.... | [
"func",
"(",
"s",
"*",
"IdentityServer",
")",
"Version",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkIdentityVersionRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkIdentityVersionResponse",
",",
"error",
")",
"{",
"var",
"(",
"v... | // Version returns version of the storage system | [
"Version",
"returns",
"version",
"of",
"the",
"storage",
"system"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/identity.go#L155-L193 |
143,738 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | Create | func (s *CloudBackupServer) Create(
ctx context.Context,
req *api.SdkCloudBackupCreateRequest,
) (*api.SdkCloudBackupCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.Ge... | go | func (s *CloudBackupServer) Create(
ctx context.Context,
req *api.SdkCloudBackupCreateRequest,
) (*api.SdkCloudBackupCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.Ge... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupCreateResponse",
",",
"error",
")",
"{",
"if",
"s",... | // Create creates a backup for a volume | [
"Create",
"creates",
"a",
"backup",
"for",
"a",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L38-L86 |
143,739 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | Restore | func (s *CloudBackupServer) Restore(
ctx context.Context,
req *api.SdkCloudBackupRestoreRequest,
) (*api.SdkCloudBackupRestoreResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.... | go | func (s *CloudBackupServer) Restore(
ctx context.Context,
req *api.SdkCloudBackupRestoreRequest,
) (*api.SdkCloudBackupRestoreResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"Restore",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupRestoreRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupRestoreResponse",
",",
"error",
")",
"{",
"if",
"... | // Restore a backup | [
"Restore",
"a",
"backup"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L89-L129 |
143,740 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | Delete | func (s *CloudBackupServer) Delete(
ctx context.Context,
req *api.SdkCloudBackupDeleteRequest,
) (*api.SdkCloudBackupDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.Get... | go | func (s *CloudBackupServer) Delete(
ctx context.Context,
req *api.SdkCloudBackupDeleteRequest,
) (*api.SdkCloudBackupDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if len(req.Get... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupDeleteResponse",
",",
"error",
")",
"{",
"if",
"s",... | // Delete deletes a backup | [
"Delete",
"deletes",
"a",
"backup"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L132-L164 |
143,741 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | DeleteAll | func (s *CloudBackupServer) DeleteAll(
ctx context.Context,
req *api.SdkCloudBackupDeleteAllRequest,
) (*api.SdkCloudBackupDeleteAllResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if le... | go | func (s *CloudBackupServer) DeleteAll(
ctx context.Context,
req *api.SdkCloudBackupDeleteAllRequest,
) (*api.SdkCloudBackupDeleteAllResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCredentialId()
var err error
if le... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"DeleteAll",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupDeleteAllRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupDeleteAllResponse",
",",
"error",
")",
"{",
"if... | // DeleteAll deletes all backups for a certain volume | [
"DeleteAll",
"deletes",
"all",
"backups",
"for",
"a",
"certain",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L167-L199 |
143,742 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | EnumerateWithFilters | func (s *CloudBackupServer) EnumerateWithFilters(
ctx context.Context,
req *api.SdkCloudBackupEnumerateWithFiltersRequest,
) (*api.SdkCloudBackupEnumerateWithFiltersResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCre... | go | func (s *CloudBackupServer) EnumerateWithFilters(
ctx context.Context,
req *api.SdkCloudBackupEnumerateWithFiltersRequest,
) (*api.SdkCloudBackupEnumerateWithFiltersResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCre... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"EnumerateWithFilters",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupEnumerateWithFiltersRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupEnumerateWithFiltersResponse",
",... | // Enumerate returns information about the backups | [
"Enumerate",
"returns",
"information",
"about",
"the",
"backups"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L202-L235 |
143,743 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | Status | func (s *CloudBackupServer) Status(
ctx context.Context,
req *api.SdkCloudBackupStatusRequest,
) (*api.SdkCloudBackupStatusResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Check ownership
if req.GetVolumeId() != "" {
if err := ... | go | func (s *CloudBackupServer) Status(
ctx context.Context,
req *api.SdkCloudBackupStatusRequest,
) (*api.SdkCloudBackupStatusResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Check ownership
if req.GetVolumeId() != "" {
if err := ... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"Status",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupStatusRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupStatusResponse",
",",
"error",
")",
"{",
"if",
"s",... | // Status provides status on a backup | [
"Status",
"provides",
"status",
"on",
"a",
"backup"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L238-L272 |
143,744 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | History | func (s *CloudBackupServer) History(
ctx context.Context,
req *api.SdkCloudBackupHistoryRequest,
) (*api.SdkCloudBackupHistoryResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetSrcVolumeId()) == 0 {
return nil, status.E... | go | func (s *CloudBackupServer) History(
ctx context.Context,
req *api.SdkCloudBackupHistoryRequest,
) (*api.SdkCloudBackupHistoryResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetSrcVolumeId()) == 0 {
return nil, status.E... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"History",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupHistoryRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupHistoryResponse",
",",
"error",
")",
"{",
"if",
"... | // History returns ?? | [
"History",
"returns",
"??"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L313-L338 |
143,745 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | StateChange | func (s *CloudBackupServer) StateChange(
ctx context.Context,
req *api.SdkCloudBackupStateChangeRequest,
) (*api.SdkCloudBackupStateChangeResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// TODO
// XXX Get vid from tid
if len(req.... | go | func (s *CloudBackupServer) StateChange(
ctx context.Context,
req *api.SdkCloudBackupStateChangeRequest,
) (*api.SdkCloudBackupStateChangeResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// TODO
// XXX Get vid from tid
if len(req.... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"StateChange",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupStateChangeRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupStateChangeResponse",
",",
"error",
")",
"{",... | // StateChange pauses and resumes backups | [
"StateChange",
"pauses",
"and",
"resumes",
"backups"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L341-L396 |
143,746 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | SchedCreate | func (s *CloudBackupServer) SchedCreate(
ctx context.Context,
req *api.SdkCloudBackupSchedCreateRequest,
) (*api.SdkCloudBackupSchedCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCloudSchedInfo().GetCredentia... | go | func (s *CloudBackupServer) SchedCreate(
ctx context.Context,
req *api.SdkCloudBackupSchedCreateRequest,
) (*api.SdkCloudBackupSchedCreateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
credId := req.GetCloudSchedInfo().GetCredentia... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"SchedCreate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupSchedCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupSchedCreateResponse",
",",
"error",
")",
"{",... | // SchedCreate new schedule for cloud backup | [
"SchedCreate",
"new",
"schedule",
"for",
"cloud",
"backup"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L399-L456 |
143,747 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | SchedDelete | func (s *CloudBackupServer) SchedDelete(
ctx context.Context,
req *api.SdkCloudBackupSchedDeleteRequest,
) (*api.SdkCloudBackupSchedDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// TODO
// XXX inspect from uuid and get volu... | go | func (s *CloudBackupServer) SchedDelete(
ctx context.Context,
req *api.SdkCloudBackupSchedDeleteRequest,
) (*api.SdkCloudBackupSchedDeleteResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// TODO
// XXX inspect from uuid and get volu... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"SchedDelete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupSchedDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupSchedDeleteResponse",
",",
"error",
")",
"{",... | // SchedDelete cloud backup schedule | [
"SchedDelete",
"cloud",
"backup",
"schedule"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L459-L482 |
143,748 | libopenstorage/openstorage | api/server/sdk/cloud_backup.go | SchedEnumerate | func (s *CloudBackupServer) SchedEnumerate(
ctx context.Context,
req *api.SdkCloudBackupSchedEnumerateRequest,
) (*api.SdkCloudBackupSchedEnumerateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Pass in ownership and show only va... | go | func (s *CloudBackupServer) SchedEnumerate(
ctx context.Context,
req *api.SdkCloudBackupSchedEnumerateRequest,
) (*api.SdkCloudBackupSchedEnumerateResponse, error) {
if s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Pass in ownership and show only va... | [
"func",
"(",
"s",
"*",
"CloudBackupServer",
")",
"SchedEnumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkCloudBackupSchedEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkCloudBackupSchedEnumerateResponse",
",",
"error",
")... | // SchedEnumerate cloud backup schedule | [
"SchedEnumerate",
"cloud",
"backup",
"schedule"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cloud_backup.go#L485-L501 |
143,749 | libopenstorage/openstorage | api/server/sdk/cluster.go | InspectCurrent | func (s *ClusterServer) InspectCurrent(
ctx context.Context,
req *api.SdkClusterInspectCurrentRequest,
) (*api.SdkClusterInspectCurrentResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
c, err := s.cluster().Enumerate()
if err != nil {
... | go | func (s *ClusterServer) InspectCurrent(
ctx context.Context,
req *api.SdkClusterInspectCurrentRequest,
) (*api.SdkClusterInspectCurrentResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
c, err := s.cluster().Enumerate()
if err != nil {
... | [
"func",
"(",
"s",
"*",
"ClusterServer",
")",
"InspectCurrent",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterInspectCurrentRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterInspectCurrentResponse",
",",
"error",
")",
"{",
... | // InspectCurrent returns information about the current cluster | [
"InspectCurrent",
"returns",
"information",
"about",
"the",
"current",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster.go#L38-L60 |
143,750 | libopenstorage/openstorage | csi/v0.3/controller.go | ControllerGetCapabilities | func (s *OsdCsiServer) ControllerGetCapabilities(
ctx context.Context,
req *csi.ControllerGetCapabilitiesRequest,
) (*csi.ControllerGetCapabilitiesResponse, error) {
// Creating and deleting volumes supported
capCreateDeleteVolume := &csi.ControllerServiceCapability{
Type: &csi.ControllerServiceCapability_Rpc{
... | go | func (s *OsdCsiServer) ControllerGetCapabilities(
ctx context.Context,
req *csi.ControllerGetCapabilitiesRequest,
) (*csi.ControllerGetCapabilitiesResponse, error) {
// Creating and deleting volumes supported
capCreateDeleteVolume := &csi.ControllerServiceCapability{
Type: &csi.ControllerServiceCapability_Rpc{
... | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"ControllerGetCapabilities",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"csi",
".",
"ControllerGetCapabilitiesRequest",
",",
")",
"(",
"*",
"csi",
".",
"ControllerGetCapabilitiesResponse",
",",
"error",
")... | // ControllerGetCapabilities is a CSI API functions which returns to the caller
// the capabilities of the OSD CSI driver. | [
"ControllerGetCapabilities",
"is",
"a",
"CSI",
"API",
"functions",
"which",
"returns",
"to",
"the",
"caller",
"the",
"capabilities",
"of",
"the",
"OSD",
"CSI",
"driver",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/v0.3/controller.go#L46-L86 |
143,751 | libopenstorage/openstorage | csi/v0.3/controller.go | ControllerPublishVolume | func (s *OsdCsiServer) ControllerPublishVolume(
context.Context,
*csi.ControllerPublishVolumeRequest,
) (*csi.ControllerPublishVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "This request is not supported")
} | go | func (s *OsdCsiServer) ControllerPublishVolume(
context.Context,
*csi.ControllerPublishVolumeRequest,
) (*csi.ControllerPublishVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "This request is not supported")
} | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"ControllerPublishVolume",
"(",
"context",
".",
"Context",
",",
"*",
"csi",
".",
"ControllerPublishVolumeRequest",
",",
")",
"(",
"*",
"csi",
".",
"ControllerPublishVolumeResponse",
",",
"error",
")",
"{",
"return",
... | // ControllerPublishVolume is a CSI API implements the attachment of a volume
// on to a node. | [
"ControllerPublishVolume",
"is",
"a",
"CSI",
"API",
"implements",
"the",
"attachment",
"of",
"a",
"volume",
"on",
"to",
"a",
"node",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/v0.3/controller.go#L90-L95 |
143,752 | libopenstorage/openstorage | csi/v0.3/controller.go | ControllerUnpublishVolume | func (s *OsdCsiServer) ControllerUnpublishVolume(
context.Context,
*csi.ControllerUnpublishVolumeRequest,
) (*csi.ControllerUnpublishVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "This request is not supported")
} | go | func (s *OsdCsiServer) ControllerUnpublishVolume(
context.Context,
*csi.ControllerUnpublishVolumeRequest,
) (*csi.ControllerUnpublishVolumeResponse, error) {
return nil, status.Error(codes.Unimplemented, "This request is not supported")
} | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"ControllerUnpublishVolume",
"(",
"context",
".",
"Context",
",",
"*",
"csi",
".",
"ControllerUnpublishVolumeRequest",
",",
")",
"(",
"*",
"csi",
".",
"ControllerUnpublishVolumeResponse",
",",
"error",
")",
"{",
"retur... | // ControllerUnpublishVolume is a CSI API which implements the detaching of a volume
// onto a node. | [
"ControllerUnpublishVolume",
"is",
"a",
"CSI",
"API",
"which",
"implements",
"the",
"detaching",
"of",
"a",
"volume",
"onto",
"a",
"node",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/v0.3/controller.go#L99-L104 |
143,753 | libopenstorage/openstorage | csi/v0.3/controller.go | osdVolumeAttributes | func osdVolumeAttributes(v *api.Volume) map[string]string {
return map[string]string{
api.SpecParent: v.GetSource().GetParent(),
api.SpecSecure: fmt.Sprintf("%v", v.GetSpec().GetEncrypted()),
api.SpecShared: fmt.Sprintf("%v", v.GetSpec().GetShared()),
"readonly": fmt.Sprintf("%v", v.GetReadonly()),
"atta... | go | func osdVolumeAttributes(v *api.Volume) map[string]string {
return map[string]string{
api.SpecParent: v.GetSource().GetParent(),
api.SpecSecure: fmt.Sprintf("%v", v.GetSpec().GetEncrypted()),
api.SpecShared: fmt.Sprintf("%v", v.GetSpec().GetShared()),
"readonly": fmt.Sprintf("%v", v.GetReadonly()),
"atta... | [
"func",
"osdVolumeAttributes",
"(",
"v",
"*",
"api",
".",
"Volume",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"api",
".",
"SpecParent",
":",
"v",
".",
"GetSource",
"(",
")",
".",
"GetParent",
"... | // osdVolumeAttributes returns the attributes of a volume as a map
// to be returned to the CSI API caller | [
"osdVolumeAttributes",
"returns",
"the",
"attributes",
"of",
"a",
"volume",
"as",
"a",
"map",
"to",
"be",
"returned",
"to",
"the",
"CSI",
"API",
"caller"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/v0.3/controller.go#L294-L304 |
143,754 | libopenstorage/openstorage | pkg/util/volume.go | VolumeFromName | func VolumeFromName(v volume.VolumeDriver, name string) (*api.Volume, error) {
vols, err := v.Inspect([]string{name})
if err == nil && len(vols) == 1 {
return vols[0], nil
}
vols, err = v.Enumerate(&api.VolumeLocator{Name: name}, nil)
if err != nil {
return nil, fmt.Errorf("Failed to locate volume %s. Error: %... | go | func VolumeFromName(v volume.VolumeDriver, name string) (*api.Volume, error) {
vols, err := v.Inspect([]string{name})
if err == nil && len(vols) == 1 {
return vols[0], nil
}
vols, err = v.Enumerate(&api.VolumeLocator{Name: name}, nil)
if err != nil {
return nil, fmt.Errorf("Failed to locate volume %s. Error: %... | [
"func",
"VolumeFromName",
"(",
"v",
"volume",
".",
"VolumeDriver",
",",
"name",
"string",
")",
"(",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"vols",
",",
"err",
":=",
"v",
".",
"Inspect",
"(",
"[",
"]",
"string",
"{",
"name",
"}",
")",
... | // VolumeFromName returns the volume object associated with the specified name. | [
"VolumeFromName",
"returns",
"the",
"volume",
"object",
"associated",
"with",
"the",
"specified",
"name",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/util/volume.go#L28-L40 |
143,755 | libopenstorage/openstorage | pkg/util/volume.go | VolumeFromIdSdk | func VolumeFromIdSdk(ctx context.Context, volumes api.OpenStorageVolumeClient, id string) (*api.Volume, error) {
inspectResp, err := volumes.Inspect(ctx, &api.SdkVolumeInspectRequest{
VolumeId: id,
})
if err != nil {
return nil, fmt.Errorf("Cannot locate volume with id %s", id)
}
return inspectResp.Volume, nil... | go | func VolumeFromIdSdk(ctx context.Context, volumes api.OpenStorageVolumeClient, id string) (*api.Volume, error) {
inspectResp, err := volumes.Inspect(ctx, &api.SdkVolumeInspectRequest{
VolumeId: id,
})
if err != nil {
return nil, fmt.Errorf("Cannot locate volume with id %s", id)
}
return inspectResp.Volume, nil... | [
"func",
"VolumeFromIdSdk",
"(",
"ctx",
"context",
".",
"Context",
",",
"volumes",
"api",
".",
"OpenStorageVolumeClient",
",",
"id",
"string",
")",
"(",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"inspectResp",
",",
"err",
":=",
"volumes",
".",
"I... | // VolumeFromIdSdk uses the SDK to fetch the volume object associated with the specified id. | [
"VolumeFromIdSdk",
"uses",
"the",
"SDK",
"to",
"fetch",
"the",
"volume",
"object",
"associated",
"with",
"the",
"specified",
"id",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/util/volume.go#L43-L51 |
143,756 | libopenstorage/openstorage | pkg/util/volume.go | VolumeFromNameSdk | func VolumeFromNameSdk(ctx context.Context, volumes api.OpenStorageVolumeClient, name string) (*api.Volume, error) {
// get volume id
volId, err := VolumeIdFromNameSdk(ctx, volumes, name)
if err != nil {
return nil, err
}
// inspect for actual volume
inspectResp, err := volumes.Inspect(ctx, &api.SdkVolumeInspe... | go | func VolumeFromNameSdk(ctx context.Context, volumes api.OpenStorageVolumeClient, name string) (*api.Volume, error) {
// get volume id
volId, err := VolumeIdFromNameSdk(ctx, volumes, name)
if err != nil {
return nil, err
}
// inspect for actual volume
inspectResp, err := volumes.Inspect(ctx, &api.SdkVolumeInspe... | [
"func",
"VolumeFromNameSdk",
"(",
"ctx",
"context",
".",
"Context",
",",
"volumes",
"api",
".",
"OpenStorageVolumeClient",
",",
"name",
"string",
")",
"(",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"// get volume id",
"volId",
",",
"err",
":=",
"V... | // VolumeFromNameSdk uses the SDK to fetch the volume associated with a specified name. | [
"VolumeFromNameSdk",
"uses",
"the",
"SDK",
"to",
"fetch",
"the",
"volume",
"associated",
"with",
"a",
"specified",
"name",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/util/volume.go#L68-L83 |
143,757 | libopenstorage/openstorage | pkg/storageops/aws/aws.go | NewEnvClient | func NewEnvClient() (storageops.Ops, error) {
region, err := storageops.GetEnvValueStrict("AWS_REGION")
if err != nil {
return nil, err
}
instance, err := storageops.GetEnvValueStrict("AWS_INSTANCE_NAME")
if err != nil {
return nil, err
}
instanceType, err := storageops.GetEnvValueStrict("AWS_INSTANCE_TYPE... | go | func NewEnvClient() (storageops.Ops, error) {
region, err := storageops.GetEnvValueStrict("AWS_REGION")
if err != nil {
return nil, err
}
instance, err := storageops.GetEnvValueStrict("AWS_INSTANCE_NAME")
if err != nil {
return nil, err
}
instanceType, err := storageops.GetEnvValueStrict("AWS_INSTANCE_TYPE... | [
"func",
"NewEnvClient",
"(",
")",
"(",
"storageops",
".",
"Ops",
",",
"error",
")",
"{",
"region",
",",
"err",
":=",
"storageops",
".",
"GetEnvValueStrict",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",... | // NewEnvClient creates a new AWS storage ops instance using environment vars | [
"NewEnvClient",
"creates",
"a",
"new",
"AWS",
"storage",
"ops",
"instance",
"using",
"environment",
"vars"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/aws/aws.go#L44-L74 |
143,758 | libopenstorage/openstorage | pkg/storageops/aws/aws.go | NewEc2Storage | func NewEc2Storage(instance, instanceType string, ec2 *ec2.EC2) storageops.Ops {
return &ec2Ops{
instance: instance,
instanceType: instanceType,
ec2: ec2,
}
} | go | func NewEc2Storage(instance, instanceType string, ec2 *ec2.EC2) storageops.Ops {
return &ec2Ops{
instance: instance,
instanceType: instanceType,
ec2: ec2,
}
} | [
"func",
"NewEc2Storage",
"(",
"instance",
",",
"instanceType",
"string",
",",
"ec2",
"*",
"ec2",
".",
"EC2",
")",
"storageops",
".",
"Ops",
"{",
"return",
"&",
"ec2Ops",
"{",
"instance",
":",
"instance",
",",
"instanceType",
":",
"instanceType",
",",
"ec2"... | // NewEc2Storage creates a new aws storage ops instance | [
"NewEc2Storage",
"creates",
"a",
"new",
"aws",
"storage",
"ops",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/aws/aws.go#L77-L83 |
143,759 | libopenstorage/openstorage | pkg/storageops/aws/aws.go | getParentDevice | func (s *ec2Ops) getParentDevice(ipDevPath string) (string, error) {
// Check if the path is a symbolic link
var parentDevPath string
fi, err := os.Lstat(ipDevPath)
if err != nil {
return "", err
}
if fi.Mode()&os.ModeSymlink != 0 {
// input device path is a symbolic link
// get the parent device
output, ... | go | func (s *ec2Ops) getParentDevice(ipDevPath string) (string, error) {
// Check if the path is a symbolic link
var parentDevPath string
fi, err := os.Lstat(ipDevPath)
if err != nil {
return "", err
}
if fi.Mode()&os.ModeSymlink != 0 {
// input device path is a symbolic link
// get the parent device
output, ... | [
"func",
"(",
"s",
"*",
"ec2Ops",
")",
"getParentDevice",
"(",
"ipDevPath",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Check if the path is a symbolic link",
"var",
"parentDevPath",
"string",
"\n",
"fi",
",",
"err",
":=",
"os",
".",
"Lstat",
"(... | // getParentDevice returns the parent device of the given device path
// by following the symbolic link. It is expected that the input device
// path exists | [
"getParentDevice",
"returns",
"the",
"parent",
"device",
"of",
"the",
"given",
"device",
"path",
"by",
"following",
"the",
"symbolic",
"link",
".",
"It",
"is",
"expected",
"that",
"the",
"input",
"device",
"path",
"exists"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/aws/aws.go#L311-L330 |
143,760 | libopenstorage/openstorage | api/client/cluster/osdconfig.go | GetClusterConf | func (c *clusterClient) GetClusterConf() (*osdconfig.ClusterConfig, error) {
config := new(osdconfig.ClusterConfig)
request := c.c.Get().Resource(clusterPath + UriCluster)
if err := request.Do().Unmarshal(config); err != nil {
return nil, err
}
return config, nil
} | go | func (c *clusterClient) GetClusterConf() (*osdconfig.ClusterConfig, error) {
config := new(osdconfig.ClusterConfig)
request := c.c.Get().Resource(clusterPath + UriCluster)
if err := request.Do().Unmarshal(config); err != nil {
return nil, err
}
return config, nil
} | [
"func",
"(",
"c",
"*",
"clusterClient",
")",
"GetClusterConf",
"(",
")",
"(",
"*",
"osdconfig",
".",
"ClusterConfig",
",",
"error",
")",
"{",
"config",
":=",
"new",
"(",
"osdconfig",
".",
"ClusterConfig",
")",
"\n",
"request",
":=",
"c",
".",
"c",
".",... | // osdconfig.ConfigCaller interface compliance | [
"osdconfig",
".",
"ConfigCaller",
"interface",
"compliance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/cluster/osdconfig.go#L16-L23 |
143,761 | libopenstorage/openstorage | csi/identity.go | GetPluginCapabilities | func (s *OsdCsiServer) GetPluginCapabilities(
ctx context.Context,
req *csi.GetPluginCapabilitiesRequest,
) (*csi.GetPluginCapabilitiesResponse, error) {
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{
&csi.PluginCapability{
Type: &csi.PluginCapability_Service_{
Servic... | go | func (s *OsdCsiServer) GetPluginCapabilities(
ctx context.Context,
req *csi.GetPluginCapabilitiesRequest,
) (*csi.GetPluginCapabilitiesResponse, error) {
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{
&csi.PluginCapability{
Type: &csi.PluginCapability_Service_{
Servic... | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"GetPluginCapabilities",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"csi",
".",
"GetPluginCapabilitiesRequest",
",",
")",
"(",
"*",
"csi",
".",
"GetPluginCapabilitiesResponse",
",",
"error",
")",
"{",
... | // GetPluginCapabilities is a CSI API | [
"GetPluginCapabilities",
"is",
"a",
"CSI",
"API"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/identity.go#L30-L52 |
143,762 | libopenstorage/openstorage | csi/identity.go | Probe | func (s *OsdCsiServer) Probe(
ctx context.Context,
req *csi.ProbeRequest,
) (*csi.ProbeResponse, error) {
return &csi.ProbeResponse{}, nil
} | go | func (s *OsdCsiServer) Probe(
ctx context.Context,
req *csi.ProbeRequest,
) (*csi.ProbeResponse, error) {
return &csi.ProbeResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"Probe",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"csi",
".",
"ProbeRequest",
",",
")",
"(",
"*",
"csi",
".",
"ProbeResponse",
",",
"error",
")",
"{",
"return",
"&",
"csi",
".",
"ProbeRespons... | // Probe is a CSI API | [
"Probe",
"is",
"a",
"CSI",
"API"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/identity.go#L55-L60 |
143,763 | libopenstorage/openstorage | csi/identity.go | GetPluginInfo | func (s *OsdCsiServer) GetPluginInfo(
ctx context.Context,
req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
return &csi.GetPluginInfoResponse{
Name: csiDriverNamePrefix + s.driver.Name(),
VendorVersion: csiDriverVersion,
// As OSD CSI Driver matures, add here more information
M... | go | func (s *OsdCsiServer) GetPluginInfo(
ctx context.Context,
req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
return &csi.GetPluginInfoResponse{
Name: csiDriverNamePrefix + s.driver.Name(),
VendorVersion: csiDriverVersion,
// As OSD CSI Driver matures, add here more information
M... | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"GetPluginInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"csi",
".",
"GetPluginInfoRequest",
")",
"(",
"*",
"csi",
".",
"GetPluginInfoResponse",
",",
"error",
")",
"{",
"return",
"&",
"csi",
"."... | // GetPluginInfo is a CSI API which returns the information about the plugin.
// This includes name, version, and any other OSD specific information | [
"GetPluginInfo",
"is",
"a",
"CSI",
"API",
"which",
"returns",
"the",
"information",
"about",
"the",
"plugin",
".",
"This",
"includes",
"name",
"version",
"and",
"any",
"other",
"OSD",
"specific",
"information"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/identity.go#L64-L77 |
143,764 | libopenstorage/openstorage | api/client/client.go | NewClient | func NewClient(host, version, userAgent string) (*Client, error) {
baseURL, err := url.Parse(host)
if err != nil {
return nil, err
}
if baseURL.Path == "" {
baseURL.Path = "/"
}
unix2HTTP(baseURL)
hClient := getHTTPClient(host)
if hClient == nil {
return nil, fmt.Errorf("Unable to parse provided url: %v",... | go | func NewClient(host, version, userAgent string) (*Client, error) {
baseURL, err := url.Parse(host)
if err != nil {
return nil, err
}
if baseURL.Path == "" {
baseURL.Path = "/"
}
unix2HTTP(baseURL)
hClient := getHTTPClient(host)
if hClient == nil {
return nil, fmt.Errorf("Unable to parse provided url: %v",... | [
"func",
"NewClient",
"(",
"host",
",",
"version",
",",
"userAgent",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"baseURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",... | // NewClient returns a new REST client for specified server. | [
"NewClient",
"returns",
"a",
"new",
"REST",
"client",
"for",
"specified",
"server",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/client.go#L19-L41 |
143,765 | libopenstorage/openstorage | api/client/client.go | GetUnixServerPath | func GetUnixServerPath(socketName string, paths ...string) string {
serverPath := "unix://"
for _, path := range paths {
serverPath = serverPath + path
}
serverPath = serverPath + socketName + ".sock"
return serverPath
} | go | func GetUnixServerPath(socketName string, paths ...string) string {
serverPath := "unix://"
for _, path := range paths {
serverPath = serverPath + path
}
serverPath = serverPath + socketName + ".sock"
return serverPath
} | [
"func",
"GetUnixServerPath",
"(",
"socketName",
"string",
",",
"paths",
"...",
"string",
")",
"string",
"{",
"serverPath",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"path",
":=",
"range",
"paths",
"{",
"serverPath",
"=",
"serverPath",
"+",
"path",
"\n",
"... | // GetUnixServerPath returns a unix domain socket prepended with the
// provided path. | [
"GetUnixServerPath",
"returns",
"a",
"unix",
"domain",
"socket",
"prepended",
"with",
"the",
"provided",
"path",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/client.go#L70-L77 |
143,766 | libopenstorage/openstorage | api/client/client.go | Get | func (c *Client) Get() *Request {
return NewRequest(c.httpClient, c.base, "GET", c.version, c.authstring, c.userAgent)
} | go | func (c *Client) Get() *Request {
return NewRequest(c.httpClient, c.base, "GET", c.version, c.authstring, c.userAgent)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Get",
"(",
")",
"*",
"Request",
"{",
"return",
"NewRequest",
"(",
"c",
".",
"httpClient",
",",
"c",
".",
"base",
",",
"\"",
"\"",
",",
"c",
".",
"version",
",",
"c",
".",
"authstring",
",",
"c",
".",
"user... | // Get returns a Request object setup for GET call. | [
"Get",
"returns",
"a",
"Request",
"object",
"setup",
"for",
"GET",
"call",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/client.go#L104-L106 |
143,767 | libopenstorage/openstorage | cli/cluster.go | ClusterCommands | func ClusterCommands() []cli.Command {
c := &clusterClient{}
commands := []cli.Command{
{
Name: "status",
Aliases: []string{"s"},
Usage: "Inspect the cluster",
Action: c.status,
Flags: []cli.Flag{
cli.StringFlag{
Name: "machine,m",
Usage: "Comma separated machine ids, e.g uuid1,... | go | func ClusterCommands() []cli.Command {
c := &clusterClient{}
commands := []cli.Command{
{
Name: "status",
Aliases: []string{"s"},
Usage: "Inspect the cluster",
Action: c.status,
Flags: []cli.Flag{
cli.StringFlag{
Name: "machine,m",
Usage: "Comma separated machine ids, e.g uuid1,... | [
"func",
"ClusterCommands",
"(",
")",
"[",
"]",
"cli",
".",
"Command",
"{",
"c",
":=",
"&",
"clusterClient",
"{",
"}",
"\n\n",
"commands",
":=",
"[",
"]",
"cli",
".",
"Command",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"Aliases",
":",
"[",
"]",
"st... | // ClusterCommands exports CLI comamnds for File VolumeDriver | [
"ClusterCommands",
"exports",
"CLI",
"comamnds",
"for",
"File",
"VolumeDriver"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cli/cluster.go#L147-L222 |
143,768 | libopenstorage/openstorage | pkg/sched/intervals.go | parseDaily | func parseDaily(dailyStr string) (RetainIntervalSpec, error) {
r, daily, err := parseRetainNumber(dailyStr)
if err != nil {
return r, err
}
if daily == "" {
return r, fmt.Errorf("Daily schedule is missing")
}
dt := strings.Split(daily, "@")
h, m, err := timeOfDay(dt[len(dt)-1])
if err != nil {
return Reta... | go | func parseDaily(dailyStr string) (RetainIntervalSpec, error) {
r, daily, err := parseRetainNumber(dailyStr)
if err != nil {
return r, err
}
if daily == "" {
return r, fmt.Errorf("Daily schedule is missing")
}
dt := strings.Split(daily, "@")
h, m, err := timeOfDay(dt[len(dt)-1])
if err != nil {
return Reta... | [
"func",
"parseDaily",
"(",
"dailyStr",
"string",
")",
"(",
"RetainIntervalSpec",
",",
"error",
")",
"{",
"r",
",",
"daily",
",",
"err",
":=",
"parseRetainNumber",
"(",
"dailyStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"r",
",",
"err",
"\n... | // parseDaily item [@]hh:mm,r | [
"parseDaily",
"item",
"["
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/sched/intervals.go#L407-L422 |
143,769 | libopenstorage/openstorage | pkg/sched/intervals.go | parseWeekly | func parseWeekly(weeklyStr string) (RetainIntervalSpec, error) {
r, weekly, err := parseRetainNumber(weeklyStr)
if err != nil {
return r, err
}
if weekly == "" {
return r, fmt.Errorf("Weekly schedule is missing")
}
dt := strings.Split(weekly, "@")
if len(dt) == 1 {
dt = append(dt, "0:0")
}
if len(dt) != ... | go | func parseWeekly(weeklyStr string) (RetainIntervalSpec, error) {
r, weekly, err := parseRetainNumber(weeklyStr)
if err != nil {
return r, err
}
if weekly == "" {
return r, fmt.Errorf("Weekly schedule is missing")
}
dt := strings.Split(weekly, "@")
if len(dt) == 1 {
dt = append(dt, "0:0")
}
if len(dt) != ... | [
"func",
"parseWeekly",
"(",
"weeklyStr",
"string",
")",
"(",
"RetainIntervalSpec",
",",
"error",
")",
"{",
"r",
",",
"weekly",
",",
"err",
":=",
"parseRetainNumber",
"(",
"weeklyStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"r",
",",
"err",
... | // parseWeekly item weekday@hh:mm,r | [
"parseWeekly",
"item",
"weekday"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/sched/intervals.go#L425-L448 |
143,770 | libopenstorage/openstorage | pkg/sched/intervals.go | parseMonthly | func parseMonthly(monthlyStr string) (RetainIntervalSpec, error) {
r, monthly, err := parseRetainNumber(monthlyStr)
if err != nil {
return r, err
}
if monthly == "" {
return r, fmt.Errorf("Monthly schedule is missing")
}
dt := strings.Split(monthly, "@")
if len(dt) == 1 {
dt = append(dt, "0:0")
}
if len(... | go | func parseMonthly(monthlyStr string) (RetainIntervalSpec, error) {
r, monthly, err := parseRetainNumber(monthlyStr)
if err != nil {
return r, err
}
if monthly == "" {
return r, fmt.Errorf("Monthly schedule is missing")
}
dt := strings.Split(monthly, "@")
if len(dt) == 1 {
dt = append(dt, "0:0")
}
if len(... | [
"func",
"parseMonthly",
"(",
"monthlyStr",
"string",
")",
"(",
"RetainIntervalSpec",
",",
"error",
")",
"{",
"r",
",",
"monthly",
",",
"err",
":=",
"parseRetainNumber",
"(",
"monthlyStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"r",
",",
"err... | // parseMonthly item day@hh:mm,r | [
"parseMonthly",
"item",
"day"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/sched/intervals.go#L451-L478 |
143,771 | libopenstorage/openstorage | pkg/sched/intervals.go | NewPolicyTagsFromSlice | func NewPolicyTagsFromSlice(policies []string) (*PolicyTags, error) {
p := &PolicyTags{Names: policies}
return p, p.verifyPolicyTags()
} | go | func NewPolicyTagsFromSlice(policies []string) (*PolicyTags, error) {
p := &PolicyTags{Names: policies}
return p, p.verifyPolicyTags()
} | [
"func",
"NewPolicyTagsFromSlice",
"(",
"policies",
"[",
"]",
"string",
")",
"(",
"*",
"PolicyTags",
",",
"error",
")",
"{",
"p",
":=",
"&",
"PolicyTags",
"{",
"Names",
":",
"policies",
"}",
"\n",
"return",
"p",
",",
"p",
".",
"verifyPolicyTags",
"(",
"... | // NewPolicyTagsFromSlice returns a new object from a string slice of names | [
"NewPolicyTagsFromSlice",
"returns",
"a",
"new",
"object",
"from",
"a",
"string",
"slice",
"of",
"names"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/sched/intervals.go#L603-L606 |
143,772 | libopenstorage/openstorage | volume/drivers/vfs/vfs.go | Init | func Init(params map[string]string) (volume.VolumeDriver, error) {
return &driver{
volume.IONotSupported,
volume.BlockNotSupported,
volume.SnapshotNotSupported,
common.NewDefaultStoreEnumerator(Name, kvdb.Instance()),
volume.StatsNotSupported,
volume.CredsNotSupported,
volume.CloudBackupNotSupported,
v... | go | func Init(params map[string]string) (volume.VolumeDriver, error) {
return &driver{
volume.IONotSupported,
volume.BlockNotSupported,
volume.SnapshotNotSupported,
common.NewDefaultStoreEnumerator(Name, kvdb.Instance()),
volume.StatsNotSupported,
volume.CredsNotSupported,
volume.CloudBackupNotSupported,
v... | [
"func",
"Init",
"(",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"volume",
".",
"VolumeDriver",
",",
"error",
")",
"{",
"return",
"&",
"driver",
"{",
"volume",
".",
"IONotSupported",
",",
"volume",
".",
"BlockNotSupported",
",",
"volume",
".... | // Init Driver intialization. | [
"Init",
"Driver",
"intialization",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/vfs/vfs.go#L42-L53 |
143,773 | libopenstorage/openstorage | api/client/request.go | Resource | func (r *Request) Resource(resource string) *Request {
if r.err == nil {
r.err = checkSet("resource", &r.resource, resource)
}
return r
} | go | func (r *Request) Resource(resource string) *Request {
if r.err == nil {
r.err = checkSet("resource", &r.resource, resource)
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Resource",
"(",
"resource",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkSet",
"(",
"\"",
"\"",
",",
"&",
"r",
".",
"resource",
",",
"resource",
... | // Resource specifies the resource to be accessed. | [
"Resource",
"specifies",
"the",
"resource",
"to",
"be",
"accessed",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L91-L96 |
143,774 | libopenstorage/openstorage | api/client/request.go | Instance | func (r *Request) Instance(instance string) *Request {
if r.err == nil {
r.err = checkExists("resource", "instance")
if r.err == nil {
r.err = checkSet("instance", &r.instance, instance)
}
}
return r
} | go | func (r *Request) Instance(instance string) *Request {
if r.err == nil {
r.err = checkExists("resource", "instance")
if r.err == nil {
r.err = checkSet("instance", &r.instance, instance)
}
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Instance",
"(",
"instance",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkExists",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"r",
".",
... | // Instance specifies the instance of the resource to be accessed. | [
"Instance",
"specifies",
"the",
"instance",
"of",
"the",
"resource",
"to",
"be",
"accessed",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L99-L107 |
143,775 | libopenstorage/openstorage | api/client/request.go | UsePath | func (r *Request) UsePath(path string) *Request {
if r.err == nil {
r.err = checkSet("path", &r.path, path)
}
return r
} | go | func (r *Request) UsePath(path string) *Request {
if r.err == nil {
r.err = checkSet("path", &r.path, path)
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"UsePath",
"(",
"path",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"==",
"nil",
"{",
"r",
".",
"err",
"=",
"checkSet",
"(",
"\"",
"\"",
",",
"&",
"r",
".",
"path",
",",
"path",
")",
"\n",... | // UsePath use the specified path and don't build up a request. | [
"UsePath",
"use",
"the",
"specified",
"path",
"and",
"don",
"t",
"build",
"up",
"a",
"request",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L110-L115 |
143,776 | libopenstorage/openstorage | api/client/request.go | QueryOption | func (r *Request) QueryOption(key string, value string) *Request {
if r.err != nil {
return r
}
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), value)
return r
} | go | func (r *Request) QueryOption(key string, value string) *Request {
if r.err != nil {
return r
}
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), value)
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"QueryOption",
"(",
"key",
"string",
",",
"value",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"if",
"r",
".",
"params",
"==",
"nil",
"{",
"... | // QueryOption adds specified options to query. | [
"QueryOption",
"adds",
"specified",
"options",
"to",
"query",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L118-L127 |
143,777 | libopenstorage/openstorage | api/client/request.go | QueryOptionLabel | func (r *Request) QueryOptionLabel(key string, labels map[string]string) *Request {
if r.err != nil {
return r
}
if b, err := json.Marshal(labels); err != nil {
r.err = err
} else {
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), string(b))
}
return r
} | go | func (r *Request) QueryOptionLabel(key string, labels map[string]string) *Request {
if r.err != nil {
return r
}
if b, err := json.Marshal(labels); err != nil {
r.err = err
} else {
if r.params == nil {
r.params = make(url.Values)
}
r.params.Add(string(key), string(b))
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"QueryOptionLabel",
"(",
"key",
"string",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"Request",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"if",
"b",
","... | // QueryOptionLabel adds specified label to query. | [
"QueryOptionLabel",
"adds",
"specified",
"label",
"to",
"query",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L130-L143 |
143,778 | libopenstorage/openstorage | api/client/request.go | Body | func (r *Request) Body(v interface{}) *Request {
var err error
if r.err != nil {
return r
}
r.body, err = json.Marshal(v)
if err != nil {
r.err = err
return r
}
return r
} | go | func (r *Request) Body(v interface{}) *Request {
var err error
if r.err != nil {
return r
}
r.body, err = json.Marshal(v)
if err != nil {
r.err = err
return r
}
return r
} | [
"func",
"(",
"r",
"*",
"Request",
")",
"Body",
"(",
"v",
"interface",
"{",
"}",
")",
"*",
"Request",
"{",
"var",
"err",
"error",
"\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"r",
".",
"body",
",",
"err",
"=",... | // Body sets the request Body. | [
"Body",
"sets",
"the",
"request",
"Body",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L165-L176 |
143,779 | libopenstorage/openstorage | api/client/request.go | headerVal | func headerVal(key string, resp *http.Response) (int, bool) {
if h := resp.Header.Get(key); len(h) > 0 {
if i, err := strconv.Atoi(h); err == nil {
return i, true
}
}
return 0, false
} | go | func headerVal(key string, resp *http.Response) (int, bool) {
if h := resp.Header.Get(key); len(h) > 0 {
if i, err := strconv.Atoi(h); err == nil {
return i, true
}
}
return 0, false
} | [
"func",
"headerVal",
"(",
"key",
"string",
",",
"resp",
"*",
"http",
".",
"Response",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"h",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"key",
")",
";",
"len",
"(",
"h",
")",
">",
"0",
"{",
"if",... | // headerVal for key as an int. Return false if header is not present or valid. | [
"headerVal",
"for",
"key",
"as",
"an",
"int",
".",
"Return",
"false",
"if",
"header",
"is",
"not",
"present",
"or",
"valid",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L209-L216 |
143,780 | libopenstorage/openstorage | api/client/request.go | Do | func (r *Request) Do() *Response {
var (
err error
req *http.Request
resp *http.Response
url string
body []byte
)
if r.err != nil {
return &Response{err: r.err}
}
url = r.URL().String()
req, err = http.NewRequest(r.verb, url, bytes.NewBuffer(r.body))
if err != nil {
return &Response{err: err}
... | go | func (r *Request) Do() *Response {
var (
err error
req *http.Request
resp *http.Response
url string
body []byte
)
if r.err != nil {
return &Response{err: r.err}
}
url = r.URL().String()
req, err = http.NewRequest(r.verb, url, bytes.NewBuffer(r.body))
if err != nil {
return &Response{err: err}
... | [
"func",
"(",
"r",
"*",
"Request",
")",
"Do",
"(",
")",
"*",
"Response",
"{",
"var",
"(",
"err",
"error",
"\n",
"req",
"*",
"http",
".",
"Request",
"\n",
"resp",
"*",
"http",
".",
"Response",
"\n",
"url",
"string",
"\n",
"body",
"[",
"]",
"byte",
... | // Do executes the request and returns a Response. | [
"Do",
"executes",
"the",
"request",
"and",
"returns",
"a",
"Response",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L235-L300 |
143,781 | libopenstorage/openstorage | api/client/request.go | Unmarshal | func (r Response) Unmarshal(v interface{}) error {
if r.err != nil {
return r.err
}
return json.Unmarshal(r.body, v)
} | go | func (r Response) Unmarshal(v interface{}) error {
if r.err != nil {
return r.err
}
return json.Unmarshal(r.body, v)
} | [
"func",
"(",
"r",
"Response",
")",
"Unmarshal",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
".",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"Unmarshal",
"(",
"r",
".",
"body",
... | // Unmarshal result into obj | [
"Unmarshal",
"result",
"into",
"obj"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L326-L331 |
143,782 | libopenstorage/openstorage | api/client/request.go | FormatError | func (r Response) FormatError() error {
if len(r.body) == 0 {
return fmt.Errorf("Error: %v", r.err)
}
return fmt.Errorf("%v", strings.TrimSpace(string(r.body)))
} | go | func (r Response) FormatError() error {
if len(r.body) == 0 {
return fmt.Errorf("Error: %v", r.err)
}
return fmt.Errorf("%v", strings.TrimSpace(string(r.body)))
} | [
"func",
"(",
"r",
"Response",
")",
"FormatError",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"r",
".",
"body",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"err",
")",
"\n",
"}",
"\n",
"return",
"fmt",
"... | // FormatError formats the error | [
"FormatError",
"formats",
"the",
"error"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/client/request.go#L339-L344 |
143,783 | libopenstorage/openstorage | pkg/mount/bind_mount.go | NewBindMounter | func NewBindMounter(
rootSubstrings []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*bindMounter, error) {
b := &bindMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: ... | go | func NewBindMounter(
rootSubstrings []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*bindMounter, error) {
b := &bindMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: ... | [
"func",
"NewBindMounter",
"(",
"rootSubstrings",
"[",
"]",
"string",
",",
"mountImpl",
"MountImpl",
",",
"allowedDirs",
"[",
"]",
"string",
",",
"trashLocation",
"string",
",",
")",
"(",
"*",
"bindMounter",
",",
"error",
")",
"{",
"b",
":=",
"&",
"bindMoun... | // NewBindMounter returns a new bindMounter | [
"NewBindMounter",
"returns",
"a",
"new",
"bindMounter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/bind_mount.go#L22-L42 |
143,784 | libopenstorage/openstorage | pkg/options/options.go | IsBoolOptionSet | func IsBoolOptionSet(options map[string]string, key string) bool {
if options != nil {
if value, ok := options[key]; ok {
if b, err := strconv.ParseBool(value); err == nil {
return b
}
}
}
return false
} | go | func IsBoolOptionSet(options map[string]string, key string) bool {
if options != nil {
if value, ok := options[key]; ok {
if b, err := strconv.ParseBool(value); err == nil {
return b
}
}
}
return false
} | [
"func",
"IsBoolOptionSet",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
")",
"bool",
"{",
"if",
"options",
"!=",
"nil",
"{",
"if",
"value",
",",
"ok",
":=",
"options",
"[",
"key",
"]",
";",
"ok",
"{",
"if",
"b",
",",
... | // IsBoolOptionSet checks if a boolean option key is set | [
"IsBoolOptionSet",
"checks",
"if",
"a",
"boolean",
"option",
"key",
"is",
"set"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L57-L67 |
143,785 | libopenstorage/openstorage | pkg/options/options.go | NewVolumeAttachOptions | func NewVolumeAttachOptions(options map[string]string) *api.SdkVolumeAttachOptions {
return &api.SdkVolumeAttachOptions{
SecretName: options[OptionsSecret],
SecretKey: options[OptionsSecretKey],
SecretContext: options[OptionsSecretContext],
}
} | go | func NewVolumeAttachOptions(options map[string]string) *api.SdkVolumeAttachOptions {
return &api.SdkVolumeAttachOptions{
SecretName: options[OptionsSecret],
SecretKey: options[OptionsSecretKey],
SecretContext: options[OptionsSecretContext],
}
} | [
"func",
"NewVolumeAttachOptions",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"api",
".",
"SdkVolumeAttachOptions",
"{",
"return",
"&",
"api",
".",
"SdkVolumeAttachOptions",
"{",
"SecretName",
":",
"options",
"[",
"OptionsSecret",
"]",
",",
... | // NewVolumeAttachOptions converts a map of options to api.SdkVolumeAttachOptions | [
"NewVolumeAttachOptions",
"converts",
"a",
"map",
"of",
"options",
"to",
"api",
".",
"SdkVolumeAttachOptions"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L70-L76 |
143,786 | libopenstorage/openstorage | pkg/options/options.go | NewVolumeUnmountOptions | func NewVolumeUnmountOptions(options map[string]string) *api.SdkVolumeUnmountOptions {
return &api.SdkVolumeUnmountOptions{
DeleteMountPath: IsBoolOptionSet(options, OptionsDeleteAfterUnmount),
NoDelayBeforeDeletingMountPath: IsBoolOptionSet(options, OptionsWaitBeforeDelete),
}
} | go | func NewVolumeUnmountOptions(options map[string]string) *api.SdkVolumeUnmountOptions {
return &api.SdkVolumeUnmountOptions{
DeleteMountPath: IsBoolOptionSet(options, OptionsDeleteAfterUnmount),
NoDelayBeforeDeletingMountPath: IsBoolOptionSet(options, OptionsWaitBeforeDelete),
}
} | [
"func",
"NewVolumeUnmountOptions",
"(",
"options",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"api",
".",
"SdkVolumeUnmountOptions",
"{",
"return",
"&",
"api",
".",
"SdkVolumeUnmountOptions",
"{",
"DeleteMountPath",
":",
"IsBoolOptionSet",
"(",
"options",
",",... | // NewVolumeUnmountOptions converts a map of options to api.SdkVolumeUnmounOptions | [
"NewVolumeUnmountOptions",
"converts",
"a",
"map",
"of",
"options",
"to",
"api",
".",
"SdkVolumeUnmounOptions"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/options/options.go#L79-L84 |
143,787 | libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Create | func (d *Driver) Create(id string, parent string, ml string, storageOpts map[string]string) error {
if parent != "" {
logrus.Infof("Creating layer %s with parent %s", id, parent)
} else {
logrus.Infof("Creating parent layer %s", id)
}
cID := C.CString(id)
cParent := C.CString(parent)
ret, err := C.create_la... | go | func (d *Driver) Create(id string, parent string, ml string, storageOpts map[string]string) error {
if parent != "" {
logrus.Infof("Creating layer %s with parent %s", id, parent)
} else {
logrus.Infof("Creating parent layer %s", id)
}
cID := C.CString(id)
cParent := C.CString(parent)
ret, err := C.create_la... | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Create",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"ml",
"string",
",",
"storageOpts",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"if",
"parent",
"!=",
"\"",
"\"",
"{",
"logrus",
".",
"In... | // Create creates a new, empty, filesystem layer with the
// specified id and parent and mountLabel. Parent and mountLabel may be "". | [
"Create",
"creates",
"a",
"new",
"empty",
"filesystem",
"layer",
"with",
"the",
"specified",
"id",
"and",
"parent",
"and",
"mountLabel",
".",
"Parent",
"and",
"mountLabel",
"may",
"be",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L80-L97 |
143,788 | libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Remove | func (d *Driver) Remove(id string) error {
logrus.Infof("Removing layer %s", id)
cID := C.CString(id)
ret, err := C.remove_layer(cID)
if int(ret) != 0 {
logrus.Warnf("Error while removing layer %s", id)
return err
}
return nil
} | go | func (d *Driver) Remove(id string) error {
logrus.Infof("Removing layer %s", id)
cID := C.CString(id)
ret, err := C.remove_layer(cID)
if int(ret) != 0 {
logrus.Warnf("Error while removing layer %s", id)
return err
}
return nil
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Remove",
"(",
"id",
"string",
")",
"error",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"id",
")",
"\n\n",
"cID",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"ret",
",",
"err",
":=",
"C",
"."... | // Remove attempts to remove the filesystem layer with this id. | [
"Remove",
"attempts",
"to",
"remove",
"the",
"filesystem",
"layer",
"with",
"this",
"id",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L100-L111 |
143,789 | libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Get | func (d *Driver) Get(id, mountLabel string) (string, error) {
cID := C.CString(id)
ret, err := C.alloc_chainfs(cID)
if int(ret) != 0 {
logrus.Warnf("Error while creating a chain FS for %s", id)
return "", err
} else {
logrus.Debugf("Created a chain FS for %s", id)
chainPath := path.Join(virtPath, id)
ret... | go | func (d *Driver) Get(id, mountLabel string) (string, error) {
cID := C.CString(id)
ret, err := C.alloc_chainfs(cID)
if int(ret) != 0 {
logrus.Warnf("Error while creating a chain FS for %s", id)
return "", err
} else {
logrus.Debugf("Created a chain FS for %s", id)
chainPath := path.Join(virtPath, id)
ret... | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Get",
"(",
"id",
",",
"mountLabel",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cID",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n\n",
"ret",
",",
"err",
":=",
"C",
".",
"alloc_chainfs",
"(",
... | // Get returns the mountpoint for the layered filesystem referred
// to by this id. You can optionally specify a mountLabel or "".
// Returns the absolute path to the mounted layered filesystem. | [
"Get",
"returns",
"the",
"mountpoint",
"for",
"the",
"layered",
"filesystem",
"referred",
"to",
"by",
"this",
"id",
".",
"You",
"can",
"optionally",
"specify",
"a",
"mountLabel",
"or",
".",
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"mounted",
"layer... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L122-L134 |
143,790 | libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | Exists | func (d *Driver) Exists(id string) bool {
path := path.Join(virtPath, id)
_, err := os.Stat(path)
if err == nil {
return true
} else {
return false
}
} | go | func (d *Driver) Exists(id string) bool {
path := path.Join(virtPath, id)
_, err := os.Stat(path)
if err == nil {
return true
} else {
return false
}
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Exists",
"(",
"id",
"string",
")",
"bool",
"{",
"path",
":=",
"path",
".",
"Join",
"(",
"virtPath",
",",
"id",
")",
"\n\n",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
"\n\n",
"if",
"err",
... | // Exists returns whether a filesystem layer with the specified
// ID exists on this driver.
// All cache entries exist. | [
"Exists",
"returns",
"whether",
"a",
"filesystem",
"layer",
"with",
"the",
"specified",
"ID",
"exists",
"on",
"this",
"driver",
".",
"All",
"cache",
"entries",
"exist",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L152-L162 |
143,791 | libopenstorage/openstorage | graph/drivers/chainfs/chainfs.go | ApplyDiff | func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
dir := path.Join(virtPath, id)
// dir := path.Join("/tmp/chainfs/", id)
logrus.Infof("Applying diff at path %s\n", dir)
if err := chrootarchive.UntarUncompressed(diff, dir, nil); err != nil {
logrus.Warnf("Error ... | go | func (d *Driver) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
dir := path.Join(virtPath, id)
// dir := path.Join("/tmp/chainfs/", id)
logrus.Infof("Applying diff at path %s\n", dir)
if err := chrootarchive.UntarUncompressed(diff, dir, nil); err != nil {
logrus.Warnf("Error ... | [
"func",
"(",
"d",
"*",
"Driver",
")",
"ApplyDiff",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"diff",
"archive",
".",
"Reader",
")",
"(",
"size",
"int64",
",",
"err",
"error",
")",
"{",
"dir",
":=",
"path",
".",
"Join",
"(",
"virtPath",
","... | // ApplyDiff extracts the changeset from the given diff into the
// layer with the specified id and parent, returning the size of the
// new layer in bytes.
// The archive.Reader must be an uncompressed stream. | [
"ApplyDiff",
"extracts",
"the",
"changeset",
"from",
"the",
"given",
"diff",
"into",
"the",
"layer",
"with",
"the",
"specified",
"id",
"and",
"parent",
"returning",
"the",
"size",
"of",
"the",
"new",
"layer",
"in",
"bytes",
".",
"The",
"archive",
".",
"Rea... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/chainfs/chainfs.go#L168-L186 |
143,792 | libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | RegisterSimpleStringEnum | func RegisterSimpleStringEnum(typeName string, typePrefix string, valueMap map[string]int32) {
if _, ok := simpleStringValueMaps[typeName]; ok {
panic("jsonpb: duplicate enum registered: " + typeName)
}
m := make(map[string]int32)
for key, value := range valueMap {
m[strings.TrimPrefix(strings.ToLower(key), fmt... | go | func RegisterSimpleStringEnum(typeName string, typePrefix string, valueMap map[string]int32) {
if _, ok := simpleStringValueMaps[typeName]; ok {
panic("jsonpb: duplicate enum registered: " + typeName)
}
m := make(map[string]int32)
for key, value := range valueMap {
m[strings.TrimPrefix(strings.ToLower(key), fmt... | [
"func",
"RegisterSimpleStringEnum",
"(",
"typeName",
"string",
",",
"typePrefix",
"string",
",",
"valueMap",
"map",
"[",
"string",
"]",
"int32",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"simpleStringValueMaps",
"[",
"typeName",
"]",
";",
"ok",
"{",
"panic",
"... | // RegisterSimpleStringEnum registers a simple string value map. | [
"RegisterSimpleStringEnum",
"registers",
"a",
"simple",
"string",
"value",
"map",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L64-L73 |
143,793 | libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | UnmarshalString | func UnmarshalString(str string, pb proto.Message) error {
return Unmarshal(strings.NewReader(str), pb)
} | go | func UnmarshalString(str string, pb proto.Message) error {
return Unmarshal(strings.NewReader(str), pb)
} | [
"func",
"UnmarshalString",
"(",
"str",
"string",
",",
"pb",
"proto",
".",
"Message",
")",
"error",
"{",
"return",
"Unmarshal",
"(",
"strings",
".",
"NewReader",
"(",
"str",
")",
",",
"pb",
")",
"\n",
"}"
] | // UnmarshalString will populate the fields of a protocol buffer based
// on a JSON string. This function is lenient and will decode any options
// permutations of the related Marshaler. | [
"UnmarshalString",
"will",
"populate",
"the",
"fields",
"of",
"a",
"protocol",
"buffer",
"based",
"on",
"a",
"JSON",
"string",
".",
"This",
"function",
"is",
"lenient",
"and",
"will",
"decode",
"any",
"options",
"permutations",
"of",
"the",
"related",
"Marshal... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L391-L393 |
143,794 | libopenstorage/openstorage | pkg/jsonpb/jsonpb.go | jsonProperties | func jsonProperties(f reflect.StructField) *proto.Properties {
var prop proto.Properties
prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
return &prop
} | go | func jsonProperties(f reflect.StructField) *proto.Properties {
var prop proto.Properties
prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
return &prop
} | [
"func",
"jsonProperties",
"(",
"f",
"reflect",
".",
"StructField",
")",
"*",
"proto",
".",
"Properties",
"{",
"var",
"prop",
"proto",
".",
"Properties",
"\n",
"prop",
".",
"Init",
"(",
"f",
".",
"Type",
",",
"f",
".",
"Name",
",",
"f",
".",
"Tag",
... | // jsonProperties returns parsed proto.Properties for the field. | [
"jsonProperties",
"returns",
"parsed",
"proto",
".",
"Properties",
"for",
"the",
"field",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/jsonpb/jsonpb.go#L554-L558 |
143,795 | libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Create | func (l *Layer0) Create(id string, parent string, mountLabel string, storageOpts map[string]string) error {
id, vol, err := l.create(id, parent)
if err != nil {
return err
}
err = l.Driver.Create(id, parent, mountLabel, storageOpts)
if err != nil || vol == nil {
return err
}
// This is layer0. Restore saved ... | go | func (l *Layer0) Create(id string, parent string, mountLabel string, storageOpts map[string]string) error {
id, vol, err := l.create(id, parent)
if err != nil {
return err
}
err = l.Driver.Create(id, parent, mountLabel, storageOpts)
if err != nil || vol == nil {
return err
}
// This is layer0. Restore saved ... | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Create",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"mountLabel",
"string",
",",
"storageOpts",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"id",
",",
"vol",
",",
"err",
":=",
"l",
".",
"cr... | // Create creates a new and empty filesystem layer | [
"Create",
"creates",
"a",
"new",
"and",
"empty",
"filesystem",
"layer"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L214-L233 |
143,796 | libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Remove | func (l *Layer0) Remove(id string) error {
if !l.isLayer0(id) {
return l.Driver.Remove(l.realID(id))
}
l.Lock()
defer l.Unlock()
var err error
v, ok := l.volumes[id]
if ok {
atomic.AddInt32(&v.ref, -1)
if v.ref == 0 {
// Save the upper dir and blow away the rest.
upperDir := path.Join(path.Join(l.ho... | go | func (l *Layer0) Remove(id string) error {
if !l.isLayer0(id) {
return l.Driver.Remove(l.realID(id))
}
l.Lock()
defer l.Unlock()
var err error
v, ok := l.volumes[id]
if ok {
atomic.AddInt32(&v.ref, -1)
if v.ref == 0 {
// Save the upper dir and blow away the rest.
upperDir := path.Join(path.Join(l.ho... | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Remove",
"(",
"id",
"string",
")",
"error",
"{",
"if",
"!",
"l",
".",
"isLayer0",
"(",
"id",
")",
"{",
"return",
"l",
".",
"Driver",
".",
"Remove",
"(",
"l",
".",
"realID",
"(",
"id",
")",
")",
"\n",
"}"... | // Remove removes a layer based on its id | [
"Remove",
"removes",
"a",
"layer",
"based",
"on",
"its",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L236-L270 |
143,797 | libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Get | func (l *Layer0) Get(id string, mountLabel string) (string, error) {
id = l.realID(id)
return l.Driver.Get(id, mountLabel)
} | go | func (l *Layer0) Get(id string, mountLabel string) (string, error) {
id = l.realID(id)
return l.Driver.Get(id, mountLabel)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Get",
"(",
"id",
"string",
",",
"mountLabel",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"Get",
"(",
"id",... | // Get returns the mountpoint for the layered filesystem | [
"Get",
"returns",
"the",
"mountpoint",
"for",
"the",
"layered",
"filesystem"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L273-L276 |
143,798 | libopenstorage/openstorage | graph/drivers/layer0/layer0.go | Put | func (l *Layer0) Put(id string) error {
id = l.realID(id)
return l.Driver.Put(id)
} | go | func (l *Layer0) Put(id string) error {
id = l.realID(id)
return l.Driver.Put(id)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"Put",
"(",
"id",
"string",
")",
"error",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",
"return",
"l",
".",
"Driver",
".",
"Put",
"(",
"id",
")",
"\n",
"}"
] | // Put releases the system resources for the specified id | [
"Put",
"releases",
"the",
"system",
"resources",
"for",
"the",
"specified",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L279-L282 |
143,799 | libopenstorage/openstorage | graph/drivers/layer0/layer0.go | ApplyDiff | func (l *Layer0) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
id = l.realID(id)
return l.Driver.ApplyDiff(id, parent, diff)
} | go | func (l *Layer0) ApplyDiff(id string, parent string, diff archive.Reader) (size int64, err error) {
id = l.realID(id)
return l.Driver.ApplyDiff(id, parent, diff)
} | [
"func",
"(",
"l",
"*",
"Layer0",
")",
"ApplyDiff",
"(",
"id",
"string",
",",
"parent",
"string",
",",
"diff",
"archive",
".",
"Reader",
")",
"(",
"size",
"int64",
",",
"err",
"error",
")",
"{",
"id",
"=",
"l",
".",
"realID",
"(",
"id",
")",
"\n",... | // ApplyDiff extracts the changeset between the specified layer and its parent | [
"ApplyDiff",
"extracts",
"the",
"changeset",
"between",
"the",
"specified",
"layer",
"and",
"its",
"parent"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/drivers/layer0/layer0.go#L285-L288 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.