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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
144,100 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | NewSdkRoleManager | func NewSdkRoleManager(kv kvdb.Kvdb) (*SdkRoleManager, error) {
s := &SdkRoleManager{
kv: kv,
}
// Load all default roles
for k, v := range defaultRoles {
role := &api.SdkRole{
Name: k,
Rules: v,
}
if _, err := kv.Put(prefixWithName(k), role, 0); err != nil {
return nil, err
}
}
return s, ni... | go | func NewSdkRoleManager(kv kvdb.Kvdb) (*SdkRoleManager, error) {
s := &SdkRoleManager{
kv: kv,
}
// Load all default roles
for k, v := range defaultRoles {
role := &api.SdkRole{
Name: k,
Rules: v,
}
if _, err := kv.Put(prefixWithName(k), role, 0); err != nil {
return nil, err
}
}
return s, ni... | [
"func",
"NewSdkRoleManager",
"(",
"kv",
"kvdb",
".",
"Kvdb",
")",
"(",
"*",
"SdkRoleManager",
",",
"error",
")",
"{",
"s",
":=",
"&",
"SdkRoleManager",
"{",
"kv",
":",
"kv",
",",
"}",
"\n\n",
"// Load all default roles",
"for",
"k",
",",
"v",
":=",
"ra... | // NewSdkRoleManager returns a new SDK role manager | [
"NewSdkRoleManager",
"returns",
"a",
"new",
"SDK",
"role",
"manager"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L152-L169 |
144,101 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Create | func (r *SdkRoleManager) Create(
ctx context.Context,
req *api.SdkRoleCreateRequest,
) (*api.SdkRoleCreateResponse, error) {
if req.GetRole() == nil {
return nil, status.Error(codes.InvalidArgument, "Must supply a role")
} else if len(req.GetRole().GetName()) == 0 {
return nil, status.Error(codes.InvalidArgumen... | go | func (r *SdkRoleManager) Create(
ctx context.Context,
req *api.SdkRoleCreateRequest,
) (*api.SdkRoleCreateResponse, error) {
if req.GetRole() == nil {
return nil, status.Error(codes.InvalidArgument, "Must supply a role")
} else if len(req.GetRole().GetName()) == 0 {
return nil, status.Error(codes.InvalidArgumen... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkRoleCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkRoleCreateResponse",
",",
"error",
")",
"{",
"if",
"req",
".",
"GetR... | // Create saves a role in Kvdb | [
"Create",
"saves",
"a",
"role",
"in",
"Kvdb"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L172-L214 |
144,102 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Enumerate | func (r *SdkRoleManager) Enumerate(
ctx context.Context,
req *api.SdkRoleEnumerateRequest,
) (*api.SdkRoleEnumerateResponse, error) {
keys, err := r.kv.Keys(rolePrefix, "/")
if err != nil {
return nil, status.Errorf(codes.Internal, "Failed to access roles from database: %v", err)
}
names := make([]string, len(... | go | func (r *SdkRoleManager) Enumerate(
ctx context.Context,
req *api.SdkRoleEnumerateRequest,
) (*api.SdkRoleEnumerateResponse, error) {
keys, err := r.kv.Keys(rolePrefix, "/")
if err != nil {
return nil, status.Errorf(codes.Internal, "Failed to access roles from database: %v", err)
}
names := make([]string, len(... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkRoleEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkRoleEnumerateResponse",
",",
"error",
")",
"{",
"keys",
",",
"er... | // Enumerate returns a list of role names | [
"Enumerate",
"returns",
"a",
"list",
"of",
"role",
"names"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L217-L234 |
144,103 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Inspect | func (r *SdkRoleManager) Inspect(
ctx context.Context,
req *api.SdkRoleInspectRequest,
) (*api.SdkRoleInspectResponse, error) {
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name for role")
}
elem := &api.SdkRole{}
_, err := r.kv.GetVal(prefixWithName(req.GetName()... | go | func (r *SdkRoleManager) Inspect(
ctx context.Context,
req *api.SdkRoleInspectRequest,
) (*api.SdkRoleInspectResponse, error) {
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name for role")
}
elem := &api.SdkRole{}
_, err := r.kv.GetVal(prefixWithName(req.GetName()... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkRoleInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkRoleInspectResponse",
",",
"error",
")",
"{",
"if",
"len",
"(",
"r... | // Inspect returns a role object | [
"Inspect",
"returns",
"a",
"role",
"object"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L237-L256 |
144,104 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Delete | func (r *SdkRoleManager) Delete(
ctx context.Context,
req *api.SdkRoleDeleteRequest,
) (*api.SdkRoleDeleteResponse, error) {
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name for role")
}
// Determine if there is collision with default roles
if _, ok := defaultRol... | go | func (r *SdkRoleManager) Delete(
ctx context.Context,
req *api.SdkRoleDeleteRequest,
) (*api.SdkRoleDeleteResponse, error) {
if len(req.GetName()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Must supply a name for role")
}
// Determine if there is collision with default roles
if _, ok := defaultRol... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkRoleDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkRoleDeleteResponse",
",",
"error",
")",
"{",
"if",
"len",
"(",
"req"... | // Delete removes a role from Kvdb | [
"Delete",
"removes",
"a",
"role",
"from",
"Kvdb"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L259-L280 |
144,105 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Update | func (r *SdkRoleManager) Update(
ctx context.Context,
req *api.SdkRoleUpdateRequest,
) (*api.SdkRoleUpdateResponse, error) {
if req.GetRole() == nil {
return nil, status.Error(codes.InvalidArgument, "Must supply a role")
}
if err := r.validateRole(req.GetRole()); err != nil {
return nil, err
}
// Determine ... | go | func (r *SdkRoleManager) Update(
ctx context.Context,
req *api.SdkRoleUpdateRequest,
) (*api.SdkRoleUpdateResponse, error) {
if req.GetRole() == nil {
return nil, status.Error(codes.InvalidArgument, "Must supply a role")
}
if err := r.validateRole(req.GetRole()); err != nil {
return nil, err
}
// Determine ... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkRoleUpdateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkRoleUpdateResponse",
",",
"error",
")",
"{",
"if",
"req",
".",
"GetR... | // Update replaces an existing role. | [
"Update",
"replaces",
"an",
"existing",
"role",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L283-L311 |
144,106 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | Verify | func (r *SdkRoleManager) Verify(ctx context.Context, roles []string, fullmethod string) error {
// Check all roles
for _, role := range roles {
// Get the role rules
resp, err := r.Inspect(ctx, &api.SdkRoleInspectRequest{
Name: role,
})
if err != nil || resp == nil || resp.GetRole() == nil {
continue
... | go | func (r *SdkRoleManager) Verify(ctx context.Context, roles []string, fullmethod string) error {
// Check all roles
for _, role := range roles {
// Get the role rules
resp, err := r.Inspect(ctx, &api.SdkRoleInspectRequest{
Name: role,
})
if err != nil || resp == nil || resp.GetRole() == nil {
continue
... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"Verify",
"(",
"ctx",
"context",
".",
"Context",
",",
"roles",
"[",
"]",
"string",
",",
"fullmethod",
"string",
")",
"error",
"{",
"// Check all roles",
"for",
"_",
",",
"role",
":=",
"range",
"roles",
"{",
... | // Verify determines if the role has access to `fullmethod` | [
"Verify",
"determines",
"if",
"the",
"role",
"has",
"access",
"to",
"fullmethod"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L314-L332 |
144,107 | libopenstorage/openstorage | pkg/role/sdkserviceapi.go | verifyRules | func (r *SdkRoleManager) verifyRules(rules []*api.SdkRule, fullmethod string) error {
var reqService, reqApi string
// String: "/openstorage.api.OpenStorage<service>/<method>"
parts := strings.Split(fullmethod, "/")
if len(parts) > 1 {
reqService = strings.TrimPrefix(strings.ToLower(parts[1]), "openstorage.api.... | go | func (r *SdkRoleManager) verifyRules(rules []*api.SdkRule, fullmethod string) error {
var reqService, reqApi string
// String: "/openstorage.api.OpenStorage<service>/<method>"
parts := strings.Split(fullmethod, "/")
if len(parts) > 1 {
reqService = strings.TrimPrefix(strings.ToLower(parts[1]), "openstorage.api.... | [
"func",
"(",
"r",
"*",
"SdkRoleManager",
")",
"verifyRules",
"(",
"rules",
"[",
"]",
"*",
"api",
".",
"SdkRule",
",",
"fullmethod",
"string",
")",
"error",
"{",
"var",
"reqService",
",",
"reqApi",
"string",
"\n\n",
"// String: \"/openstorage.api.OpenStorage<serv... | // verifyRules checks if the rules authorize use of the API called `fullmethod` | [
"verifyRules",
"checks",
"if",
"the",
"rules",
"authorize",
"use",
"of",
"the",
"API",
"called",
"fullmethod"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/role/sdkserviceapi.go#L335-L363 |
144,108 | libopenstorage/openstorage | pkg/seed/seed.go | New | func New(uri string, options map[string]string) (Source, error) {
u, err := url.Parse(uri)
if err != nil {
return nil, err
}
switch u.Scheme {
case "github":
return NewGitSource(uri, options)
}
return nil, ErrUnsupported
} | go | func New(uri string, options map[string]string) (Source, error) {
u, err := url.Parse(uri)
if err != nil {
return nil, err
}
switch u.Scheme {
case "github":
return NewGitSource(uri, options)
}
return nil, ErrUnsupported
} | [
"func",
"New",
"(",
"uri",
"string",
",",
"options",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"Source",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"uri",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"n... | // New returns a new instance of Source | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"Source"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/seed/seed.go#L26-L36 |
144,109 | libopenstorage/openstorage | api/server/sdk/objectstore.go | Inspect | func (s *ObjectstoreServer) Inspect(
ctx context.Context,
req *api.SdkObjectstoreInspectRequest,
) (*api.SdkObjectstoreInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
objResp, err := s.cluster().ObjectStoreInspect(req.GetObject... | go | func (s *ObjectstoreServer) Inspect(
ctx context.Context,
req *api.SdkObjectstoreInspectRequest,
) (*api.SdkObjectstoreInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
objResp, err := s.cluster().ObjectStoreInspect(req.GetObject... | [
"func",
"(",
"s",
"*",
"ObjectstoreServer",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkObjectstoreInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkObjectstoreInspectResponse",
",",
"error",
")",
"{",
"if",
"... | // Inspect Objectstore return status of provided objectstore | [
"Inspect",
"Objectstore",
"return",
"status",
"of",
"provided",
"objectstore"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/objectstore.go#L40-L63 |
144,110 | libopenstorage/openstorage | api/server/sdk/objectstore.go | Create | func (s *ObjectstoreServer) Create(
ctx context.Context,
req *api.SdkObjectstoreCreateRequest,
) (*api.SdkObjectstoreCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(cod... | go | func (s *ObjectstoreServer) Create(
ctx context.Context,
req *api.SdkObjectstoreCreateRequest,
) (*api.SdkObjectstoreCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(cod... | [
"func",
"(",
"s",
"*",
"ObjectstoreServer",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkObjectstoreCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkObjectstoreCreateResponse",
",",
"error",
")",
"{",
"if",
"s",... | // CreateObjectstore creates objectstore for given volume | [
"CreateObjectstore",
"creates",
"objectstore",
"for",
"given",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/objectstore.go#L66-L86 |
144,111 | libopenstorage/openstorage | api/server/sdk/objectstore.go | Update | func (s *ObjectstoreServer) Update(
ctx context.Context,
req *api.SdkObjectstoreUpdateRequest,
) (*api.SdkObjectstoreUpdateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
err := s.cluster().ObjectStoreUpdate(req.GetObjectstoreId(), re... | go | func (s *ObjectstoreServer) Update(
ctx context.Context,
req *api.SdkObjectstoreUpdateRequest,
) (*api.SdkObjectstoreUpdateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
err := s.cluster().ObjectStoreUpdate(req.GetObjectstoreId(), re... | [
"func",
"(",
"s",
"*",
"ObjectstoreServer",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkObjectstoreUpdateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkObjectstoreUpdateResponse",
",",
"error",
")",
"{",
"if",
"s",... | // UpdateObjectstore updates given objectstore state | [
"UpdateObjectstore",
"updates",
"given",
"objectstore",
"state"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/objectstore.go#L89-L112 |
144,112 | libopenstorage/openstorage | api/server/sdk/objectstore.go | Delete | func (s *ObjectstoreServer) Delete(
ctx context.Context,
req *api.SdkObjectstoreDeleteRequest,
) (*api.SdkObjectstoreDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
err := s.cluster().ObjectStoreDelete(req.GetObjectstoreId())
i... | go | func (s *ObjectstoreServer) Delete(
ctx context.Context,
req *api.SdkObjectstoreDeleteRequest,
) (*api.SdkObjectstoreDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
err := s.cluster().ObjectStoreDelete(req.GetObjectstoreId())
i... | [
"func",
"(",
"s",
"*",
"ObjectstoreServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkObjectstoreDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkObjectstoreDeleteResponse",
",",
"error",
")",
"{",
"if",
"s",... | // DeleteObjectstore delete objectstore from cluster | [
"DeleteObjectstore",
"delete",
"objectstore",
"from",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/objectstore.go#L115-L132 |
144,113 | libopenstorage/openstorage | csi/csi.go | NewOsdCsiServer | func NewOsdCsiServer(config *OsdCsiServerConfig) (grpcserver.Server, error) {
if nil == config {
return nil, fmt.Errorf("Must supply configuration")
}
if len(config.SdkUds) == 0 {
return nil, fmt.Errorf("SdkUds must be provided")
}
if len(config.DriverName) == 0 {
return nil, fmt.Errorf("OSD Driver name must... | go | func NewOsdCsiServer(config *OsdCsiServerConfig) (grpcserver.Server, error) {
if nil == config {
return nil, fmt.Errorf("Must supply configuration")
}
if len(config.SdkUds) == 0 {
return nil, fmt.Errorf("SdkUds must be provided")
}
if len(config.DriverName) == 0 {
return nil, fmt.Errorf("OSD Driver name must... | [
"func",
"NewOsdCsiServer",
"(",
"config",
"*",
"OsdCsiServerConfig",
")",
"(",
"grpcserver",
".",
"Server",
",",
"error",
")",
"{",
"if",
"nil",
"==",
"config",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"... | // NewOsdCsiServer creates a gRPC CSI complient server on the
// specified port and transport. | [
"NewOsdCsiServer",
"creates",
"a",
"gRPC",
"CSI",
"complient",
"server",
"on",
"the",
"specified",
"port",
"and",
"transport",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/csi.go#L64-L97 |
144,114 | libopenstorage/openstorage | csi/csi.go | setupContextWithToken | func (s *OsdCsiServer) setupContextWithToken(ctx context.Context, csiSecrets map[string]string) context.Context {
if token, ok := csiSecrets[authsecrets.SecretTokenKey]; ok {
md := metadata.New(map[string]string{
"authorization": "bearer " + token,
})
return metadata.NewOutgoingContext(ctx, md)
}
return ctx... | go | func (s *OsdCsiServer) setupContextWithToken(ctx context.Context, csiSecrets map[string]string) context.Context {
if token, ok := csiSecrets[authsecrets.SecretTokenKey]; ok {
md := metadata.New(map[string]string{
"authorization": "bearer " + token,
})
return metadata.NewOutgoingContext(ctx, md)
}
return ctx... | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"setupContextWithToken",
"(",
"ctx",
"context",
".",
"Context",
",",
"csiSecrets",
"map",
"[",
"string",
"]",
"string",
")",
"context",
".",
"Context",
"{",
"if",
"token",
",",
"ok",
":=",
"csiSecrets",
"[",
"a... | // Gets token from the secrets. In Kubernetes, the side car containers copy
// the contents of a K8S Secret map into the Secrets section of the CSI call. | [
"Gets",
"token",
"from",
"the",
"secrets",
".",
"In",
"Kubernetes",
"the",
"side",
"car",
"containers",
"copy",
"the",
"contents",
"of",
"a",
"K8S",
"Secret",
"map",
"into",
"the",
"Secrets",
"section",
"of",
"the",
"CSI",
"call",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/csi.go#L117-L125 |
144,115 | libopenstorage/openstorage | pkg/storageops/storageops.go | NewStorageError | func NewStorageError(code int, msg string, instance string) error {
return &StorageError{Code: code, Msg: msg, Instance: instance}
} | go | func NewStorageError(code int, msg string, instance string) error {
return &StorageError{Code: code, Msg: msg, Instance: instance}
} | [
"func",
"NewStorageError",
"(",
"code",
"int",
",",
"msg",
"string",
",",
"instance",
"string",
")",
"error",
"{",
"return",
"&",
"StorageError",
"{",
"Code",
":",
"code",
",",
"Msg",
":",
"msg",
",",
"Instance",
":",
"instance",
"}",
"\n",
"}"
] | // NewStorageError creates a new custom storage error instance | [
"NewStorageError",
"creates",
"a",
"new",
"custom",
"storage",
"error",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/storageops.go#L93-L95 |
144,116 | libopenstorage/openstorage | api/api.go | DriverTypeSimpleValueOf | func DriverTypeSimpleValueOf(s string) (DriverType, error) {
obj, err := simpleValueOf("driver_type", DriverType_value, s)
return DriverType(obj), err
} | go | func DriverTypeSimpleValueOf(s string) (DriverType, error) {
obj, err := simpleValueOf("driver_type", DriverType_value, s)
return DriverType(obj), err
} | [
"func",
"DriverTypeSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"DriverType",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"DriverType_value",
",",
"s",
")",
"\n",
"return",
"DriverType",
"(",
"obj",
")",
",",
... | //
// DriverTypeSimpleValueOf returns the string format of DriverType | [
"DriverTypeSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"DriverType"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L580-L583 |
144,117 | libopenstorage/openstorage | api/api.go | FSTypeSimpleValueOf | func FSTypeSimpleValueOf(s string) (FSType, error) {
obj, err := simpleValueOf("fs_type", FSType_value, s)
return FSType(obj), err
} | go | func FSTypeSimpleValueOf(s string) (FSType, error) {
obj, err := simpleValueOf("fs_type", FSType_value, s)
return FSType(obj), err
} | [
"func",
"FSTypeSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"FSType",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"FSType_value",
",",
"s",
")",
"\n",
"return",
"FSType",
"(",
"obj",
")",
",",
"err",
"\n",... | // FSTypeSimpleValueOf returns the string format of FSType | [
"FSTypeSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"FSType"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L591-L594 |
144,118 | libopenstorage/openstorage | api/api.go | CosTypeSimpleValueOf | func CosTypeSimpleValueOf(s string) (CosType, error) {
obj, exists := CosType_value[strings.ToUpper(s)]
if !exists {
return -1, fmt.Errorf("Invalid cos value: %s", s)
}
return CosType(obj), nil
} | go | func CosTypeSimpleValueOf(s string) (CosType, error) {
obj, exists := CosType_value[strings.ToUpper(s)]
if !exists {
return -1, fmt.Errorf("Invalid cos value: %s", s)
}
return CosType(obj), nil
} | [
"func",
"CosTypeSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"CosType",
",",
"error",
")",
"{",
"obj",
",",
"exists",
":=",
"CosType_value",
"[",
"strings",
".",
"ToUpper",
"(",
"s",
")",
"]",
"\n",
"if",
"!",
"exists",
"{",
"return",
"-",
"1",
",",... | // CosTypeSimpleValueOf returns the string format of CosType | [
"CosTypeSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"CosType"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L602-L608 |
144,119 | libopenstorage/openstorage | api/api.go | GraphDriverChangeTypeSimpleValueOf | func GraphDriverChangeTypeSimpleValueOf(s string) (GraphDriverChangeType, error) {
obj, err := simpleValueOf("graph_driver_change_type", GraphDriverChangeType_value, s)
return GraphDriverChangeType(obj), err
} | go | func GraphDriverChangeTypeSimpleValueOf(s string) (GraphDriverChangeType, error) {
obj, err := simpleValueOf("graph_driver_change_type", GraphDriverChangeType_value, s)
return GraphDriverChangeType(obj), err
} | [
"func",
"GraphDriverChangeTypeSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"GraphDriverChangeType",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"GraphDriverChangeType_value",
",",
"s",
")",
"\n",
"return",
"GraphDrive... | // GraphDriverChangeTypeSimpleValueOf returns the string format of GraphDriverChangeType | [
"GraphDriverChangeTypeSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"GraphDriverChangeType"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L616-L619 |
144,120 | libopenstorage/openstorage | api/api.go | VolumeActionParamSimpleValueOf | func VolumeActionParamSimpleValueOf(s string) (VolumeActionParam, error) {
obj, err := simpleValueOf("volume_action_param", VolumeActionParam_value, s)
return VolumeActionParam(obj), err
} | go | func VolumeActionParamSimpleValueOf(s string) (VolumeActionParam, error) {
obj, err := simpleValueOf("volume_action_param", VolumeActionParam_value, s)
return VolumeActionParam(obj), err
} | [
"func",
"VolumeActionParamSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"VolumeActionParam",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"VolumeActionParam_value",
",",
"s",
")",
"\n",
"return",
"VolumeActionParam",
... | // VolumeActionParamSimpleValueOf returns the string format of VolumeAction | [
"VolumeActionParamSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"VolumeAction"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L627-L630 |
144,121 | libopenstorage/openstorage | api/api.go | VolumeStateSimpleValueOf | func VolumeStateSimpleValueOf(s string) (VolumeState, error) {
obj, err := simpleValueOf("volume_state", VolumeState_value, s)
return VolumeState(obj), err
} | go | func VolumeStateSimpleValueOf(s string) (VolumeState, error) {
obj, err := simpleValueOf("volume_state", VolumeState_value, s)
return VolumeState(obj), err
} | [
"func",
"VolumeStateSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"VolumeState",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"VolumeState_value",
",",
"s",
")",
"\n",
"return",
"VolumeState",
"(",
"obj",
")",
"... | // VolumeStateSimpleValueOf returns the string format of VolumeState | [
"VolumeStateSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"VolumeState"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L638-L641 |
144,122 | libopenstorage/openstorage | api/api.go | VolumeStatusSimpleValueOf | func VolumeStatusSimpleValueOf(s string) (VolumeStatus, error) {
obj, err := simpleValueOf("volume_status", VolumeStatus_value, s)
return VolumeStatus(obj), err
} | go | func VolumeStatusSimpleValueOf(s string) (VolumeStatus, error) {
obj, err := simpleValueOf("volume_status", VolumeStatus_value, s)
return VolumeStatus(obj), err
} | [
"func",
"VolumeStatusSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"VolumeStatus",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"VolumeStatus_value",
",",
"s",
")",
"\n",
"return",
"VolumeStatus",
"(",
"obj",
")",... | // VolumeStatusSimpleValueOf returns the string format of VolumeStatus | [
"VolumeStatusSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"VolumeStatus"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L649-L652 |
144,123 | libopenstorage/openstorage | api/api.go | IoProfileSimpleValueOf | func IoProfileSimpleValueOf(s string) (IoProfile, error) {
obj, err := simpleValueOf("io_profile", IoProfile_value, s)
return IoProfile(obj), err
} | go | func IoProfileSimpleValueOf(s string) (IoProfile, error) {
obj, err := simpleValueOf("io_profile", IoProfile_value, s)
return IoProfile(obj), err
} | [
"func",
"IoProfileSimpleValueOf",
"(",
"s",
"string",
")",
"(",
"IoProfile",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"simpleValueOf",
"(",
"\"",
"\"",
",",
"IoProfile_value",
",",
"s",
")",
"\n",
"return",
"IoProfile",
"(",
"obj",
")",
",",
"e... | // IoProfileSimpleValueOf returns the string format of IoProfile | [
"IoProfileSimpleValueOf",
"returns",
"the",
"string",
"format",
"of",
"IoProfile"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L660-L663 |
144,124 | libopenstorage/openstorage | api/api.go | WriteThroughput | func (v *Stats) WriteThroughput() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.WriteBytes) / intv
} | go | func (v *Stats) WriteThroughput() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.WriteBytes) / intv
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"WriteThroughput",
"(",
")",
"uint64",
"{",
"intv",
":=",
"toSec",
"(",
"v",
".",
"IntervalMs",
")",
"\n",
"if",
"intv",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"v",
".",
"WriteBytes",
"... | // WriteThroughput returns the write throughput | [
"WriteThroughput",
"returns",
"the",
"write",
"throughput"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L691-L697 |
144,125 | libopenstorage/openstorage | api/api.go | ReadThroughput | func (v *Stats) ReadThroughput() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.ReadBytes) / intv
} | go | func (v *Stats) ReadThroughput() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.ReadBytes) / intv
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"ReadThroughput",
"(",
")",
"uint64",
"{",
"intv",
":=",
"toSec",
"(",
"v",
".",
"IntervalMs",
")",
"\n",
"if",
"intv",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"v",
".",
"ReadBytes",
")"... | // ReadThroughput returns the read throughput | [
"ReadThroughput",
"returns",
"the",
"read",
"throughput"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L700-L706 |
144,126 | libopenstorage/openstorage | api/api.go | Latency | func (v *Stats) Latency() uint64 {
ops := v.Writes + v.Reads
if ops == 0 {
return 0
}
return (uint64)((v.IoMs * 1000) / ops)
} | go | func (v *Stats) Latency() uint64 {
ops := v.Writes + v.Reads
if ops == 0 {
return 0
}
return (uint64)((v.IoMs * 1000) / ops)
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"Latency",
"(",
")",
"uint64",
"{",
"ops",
":=",
"v",
".",
"Writes",
"+",
"v",
".",
"Reads",
"\n",
"if",
"ops",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"uint64",
")",
"(",
"(",
"v",
... | // Latency returns latency | [
"Latency",
"returns",
"latency"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L709-L715 |
144,127 | libopenstorage/openstorage | api/api.go | ReadLatency | func (v *Stats) ReadLatency() uint64 {
if v.Reads == 0 {
return 0
}
return (uint64)((v.ReadMs * 1000) / v.Reads)
} | go | func (v *Stats) ReadLatency() uint64 {
if v.Reads == 0 {
return 0
}
return (uint64)((v.ReadMs * 1000) / v.Reads)
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"ReadLatency",
"(",
")",
"uint64",
"{",
"if",
"v",
".",
"Reads",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"uint64",
")",
"(",
"(",
"v",
".",
"ReadMs",
"*",
"1000",
")",
"/",
"v",
".",... | // Read latency returns avg. time required for read operation to complete | [
"Read",
"latency",
"returns",
"avg",
".",
"time",
"required",
"for",
"read",
"operation",
"to",
"complete"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L718-L723 |
144,128 | libopenstorage/openstorage | api/api.go | WriteLatency | func (v *Stats) WriteLatency() uint64 {
if v.Writes == 0 {
return 0
}
return (uint64)((v.WriteMs * 1000) / v.Writes)
} | go | func (v *Stats) WriteLatency() uint64 {
if v.Writes == 0 {
return 0
}
return (uint64)((v.WriteMs * 1000) / v.Writes)
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"WriteLatency",
"(",
")",
"uint64",
"{",
"if",
"v",
".",
"Writes",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"uint64",
")",
"(",
"(",
"v",
".",
"WriteMs",
"*",
"1000",
")",
"/",
"v",
"... | // Write latency returns avg. time required for write operation to complete | [
"Write",
"latency",
"returns",
"avg",
".",
"time",
"required",
"for",
"write",
"operation",
"to",
"complete"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L726-L731 |
144,129 | libopenstorage/openstorage | api/api.go | Iops | func (v *Stats) Iops() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.Writes + v.Reads) / intv
} | go | func (v *Stats) Iops() uint64 {
intv := toSec(v.IntervalMs)
if intv == 0 {
return 0
}
return (v.Writes + v.Reads) / intv
} | [
"func",
"(",
"v",
"*",
"Stats",
")",
"Iops",
"(",
")",
"uint64",
"{",
"intv",
":=",
"toSec",
"(",
"v",
".",
"IntervalMs",
")",
"\n",
"if",
"intv",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"(",
"v",
".",
"Writes",
"+",
"v",
".... | // Iops returns iops | [
"Iops",
"returns",
"iops"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L734-L740 |
144,130 | libopenstorage/openstorage | api/api.go | Contains | func (m *Volume) Contains(mid string) bool {
rsets := m.GetReplicaSets()
for _, rset := range rsets {
for _, node := range rset.Nodes {
if node == mid {
return true
}
}
}
return false
} | go | func (m *Volume) Contains(mid string) bool {
rsets := m.GetReplicaSets()
for _, rset := range rsets {
for _, node := range rset.Nodes {
if node == mid {
return true
}
}
}
return false
} | [
"func",
"(",
"m",
"*",
"Volume",
")",
"Contains",
"(",
"mid",
"string",
")",
"bool",
"{",
"rsets",
":=",
"m",
".",
"GetReplicaSets",
"(",
")",
"\n",
"for",
"_",
",",
"rset",
":=",
"range",
"rsets",
"{",
"for",
"_",
",",
"node",
":=",
"range",
"rs... | // Contains returns true if mid is a member of volume's replication set. | [
"Contains",
"returns",
"true",
"if",
"mid",
"is",
"a",
"member",
"of",
"volume",
"s",
"replication",
"set",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L748-L758 |
144,131 | libopenstorage/openstorage | api/api.go | Copy | func (s *VolumeSpec) Copy() *VolumeSpec {
spec := *s
if s.ReplicaSet != nil {
spec.ReplicaSet = &ReplicaSet{Nodes: make([]string, len(s.ReplicaSet.Nodes))}
copy(spec.ReplicaSet.Nodes, s.ReplicaSet.Nodes)
}
return &spec
} | go | func (s *VolumeSpec) Copy() *VolumeSpec {
spec := *s
if s.ReplicaSet != nil {
spec.ReplicaSet = &ReplicaSet{Nodes: make([]string, len(s.ReplicaSet.Nodes))}
copy(spec.ReplicaSet.Nodes, s.ReplicaSet.Nodes)
}
return &spec
} | [
"func",
"(",
"s",
"*",
"VolumeSpec",
")",
"Copy",
"(",
")",
"*",
"VolumeSpec",
"{",
"spec",
":=",
"*",
"s",
"\n",
"if",
"s",
".",
"ReplicaSet",
"!=",
"nil",
"{",
"spec",
".",
"ReplicaSet",
"=",
"&",
"ReplicaSet",
"{",
"Nodes",
":",
"make",
"(",
"... | // Copy makes a deep copy of VolumeSpec | [
"Copy",
"makes",
"a",
"deep",
"copy",
"of",
"VolumeSpec"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L761-L768 |
144,132 | libopenstorage/openstorage | api/api.go | Copy | func (s *Node) Copy() *Node {
localCopy := deepcopy.Copy(*s)
nodeCopy := localCopy.(Node)
return &nodeCopy
} | go | func (s *Node) Copy() *Node {
localCopy := deepcopy.Copy(*s)
nodeCopy := localCopy.(Node)
return &nodeCopy
} | [
"func",
"(",
"s",
"*",
"Node",
")",
"Copy",
"(",
")",
"*",
"Node",
"{",
"localCopy",
":=",
"deepcopy",
".",
"Copy",
"(",
"*",
"s",
")",
"\n",
"nodeCopy",
":=",
"localCopy",
".",
"(",
"Node",
")",
"\n",
"return",
"&",
"nodeCopy",
"\n",
"}"
] | // Copy makes a deep copy of Node | [
"Copy",
"makes",
"a",
"deep",
"copy",
"of",
"Node"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L771-L775 |
144,133 | libopenstorage/openstorage | api/api.go | ToStorageNode | func (s *Node) ToStorageNode() *StorageNode {
node := &StorageNode{
Id: s.Id,
SchedulerNodeName: s.SchedulerNodeName,
Cpu: s.Cpu,
MemTotal: s.MemTotal,
MemUsed: s.MemUsed,
MemFree: s.MemFree,
AvgLoad: int64(s.Avgload),
Status: ... | go | func (s *Node) ToStorageNode() *StorageNode {
node := &StorageNode{
Id: s.Id,
SchedulerNodeName: s.SchedulerNodeName,
Cpu: s.Cpu,
MemTotal: s.MemTotal,
MemUsed: s.MemUsed,
MemFree: s.MemFree,
AvgLoad: int64(s.Avgload),
Status: ... | [
"func",
"(",
"s",
"*",
"Node",
")",
"ToStorageNode",
"(",
")",
"*",
"StorageNode",
"{",
"node",
":=",
"&",
"StorageNode",
"{",
"Id",
":",
"s",
".",
"Id",
",",
"SchedulerNodeName",
":",
"s",
".",
"SchedulerNodeName",
",",
"Cpu",
":",
"s",
".",
"Cpu",
... | // ToStorageNode converts a Node structure to an exported gRPC StorageNode struct | [
"ToStorageNode",
"converts",
"a",
"Node",
"structure",
"to",
"an",
"exported",
"gRPC",
"StorageNode",
"struct"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L794-L825 |
144,134 | libopenstorage/openstorage | api/api.go | ToStorageCluster | func (c *Cluster) ToStorageCluster() *StorageCluster {
cluster := &StorageCluster{
Status: c.Status,
// Due to history, the cluster ID is normally the name of the cluster, not the
// unique identifier
Name: c.Id,
}
return cluster
} | go | func (c *Cluster) ToStorageCluster() *StorageCluster {
cluster := &StorageCluster{
Status: c.Status,
// Due to history, the cluster ID is normally the name of the cluster, not the
// unique identifier
Name: c.Id,
}
return cluster
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ToStorageCluster",
"(",
")",
"*",
"StorageCluster",
"{",
"cluster",
":=",
"&",
"StorageCluster",
"{",
"Status",
":",
"c",
".",
"Status",
",",
"// Due to history, the cluster ID is normally the name of the cluster, not the",
"// ... | // ToStorageCluster converts a Cluster structure to an exported gRPC StorageCluster struct | [
"ToStorageCluster",
"converts",
"a",
"Cluster",
"structure",
"to",
"an",
"exported",
"gRPC",
"StorageCluster",
"struct"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L828-L838 |
144,135 | libopenstorage/openstorage | api/api.go | GetCloneCreatorOwnership | func (v *VolumeSpec) GetCloneCreatorOwnership(ctx context.Context) (*Ownership, bool) {
o := v.GetOwnership()
// If there is user information, then auth is enabled
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check if the owner is the one who cloned it
if o != nil && o.IsOwner(userinfo) {
re... | go | func (v *VolumeSpec) GetCloneCreatorOwnership(ctx context.Context) (*Ownership, bool) {
o := v.GetOwnership()
// If there is user information, then auth is enabled
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check if the owner is the one who cloned it
if o != nil && o.IsOwner(userinfo) {
re... | [
"func",
"(",
"v",
"*",
"VolumeSpec",
")",
"GetCloneCreatorOwnership",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"Ownership",
",",
"bool",
")",
"{",
"o",
":=",
"v",
".",
"GetOwnership",
"(",
")",
"\n\n",
"// If there is user information, then auth i... | // GetCloneCreatorOwnership returns the appropriate ownership for the
// new snapshot and if an update is required | [
"GetCloneCreatorOwnership",
"returns",
"the",
"appropriate",
"ownership",
"for",
"the",
"new",
"snapshot",
"and",
"if",
"an",
"update",
"is",
"required"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L1033-L1050 |
144,136 | libopenstorage/openstorage | api/api.go | IsPermitted | func (s *SdkStoragePolicy) IsPermitted(ctx context.Context, accessType Ownership_AccessType) bool {
if s.IsPublic() {
return true
}
// Storage Policy is not public, check permission
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check Access
return s.IsPermittedFromUserInfo(userinfo, accessType... | go | func (s *SdkStoragePolicy) IsPermitted(ctx context.Context, accessType Ownership_AccessType) bool {
if s.IsPublic() {
return true
}
// Storage Policy is not public, check permission
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check Access
return s.IsPermittedFromUserInfo(userinfo, accessType... | [
"func",
"(",
"s",
"*",
"SdkStoragePolicy",
")",
"IsPermitted",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessType",
"Ownership_AccessType",
")",
"bool",
"{",
"if",
"s",
".",
"IsPublic",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// Storage P... | // Check access permission of SdkStoragePolicy Objects | [
"Check",
"access",
"permission",
"of",
"SdkStoragePolicy",
"Objects"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.go#L1054-L1068 |
144,137 | libopenstorage/openstorage | pkg/auth/secrets/secrets.go | NewAuth | func NewAuth(
authProviderType AuthTokenProviders,
s osecrets.Secrets,
) (Auth, error) {
if s == nil {
return nil, ErrSecretsNotInitialized
}
switch authProviderType {
case TypeK8s:
return &k8sAuth{s}, nil
case TypeDCOS:
return &dcosAuth{s}, nil
}
return nil, fmt.Errorf("secrets type %v not supported", a... | go | func NewAuth(
authProviderType AuthTokenProviders,
s osecrets.Secrets,
) (Auth, error) {
if s == nil {
return nil, ErrSecretsNotInitialized
}
switch authProviderType {
case TypeK8s:
return &k8sAuth{s}, nil
case TypeDCOS:
return &dcosAuth{s}, nil
}
return nil, fmt.Errorf("secrets type %v not supported", a... | [
"func",
"NewAuth",
"(",
"authProviderType",
"AuthTokenProviders",
",",
"s",
"osecrets",
".",
"Secrets",
",",
")",
"(",
"Auth",
",",
"error",
")",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrSecretsNotInitialized",
"\n",
"}",
"\n",
"switch",... | // NewAuth returns a new instance of Auth implementation | [
"NewAuth",
"returns",
"a",
"new",
"instance",
"of",
"Auth",
"implementation"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/secrets/secrets.go#L55-L69 |
144,138 | libopenstorage/openstorage | pkg/mount/custom_mount.go | NewCustomMounter | func NewCustomMounter(
devPrefixes []string,
mountImpl MountImpl,
customMounter CustomMounter,
allowedDirs []string,
) (*CustomMounterHandler, error) {
m := &CustomMounterHandler{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowed... | go | func NewCustomMounter(
devPrefixes []string,
mountImpl MountImpl,
customMounter CustomMounter,
allowedDirs []string,
) (*CustomMounterHandler, error) {
m := &CustomMounterHandler{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowed... | [
"func",
"NewCustomMounter",
"(",
"devPrefixes",
"[",
"]",
"string",
",",
"mountImpl",
"MountImpl",
",",
"customMounter",
"CustomMounter",
",",
"allowedDirs",
"[",
"]",
"string",
",",
")",
"(",
"*",
"CustomMounterHandler",
",",
"error",
")",
"{",
"m",
":=",
"... | // NewCustomMounter returns a new CustomMounter | [
"NewCustomMounter",
"returns",
"a",
"new",
"CustomMounter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/custom_mount.go#L22-L46 |
144,139 | libopenstorage/openstorage | pkg/mount/custom_mount.go | Reload | func (c *CustomMounterHandler) Reload(device string) error {
return c.cr(device, c.mounts, c.paths)
} | go | func (c *CustomMounterHandler) Reload(device string) error {
return c.cr(device, c.mounts, c.paths)
} | [
"func",
"(",
"c",
"*",
"CustomMounterHandler",
")",
"Reload",
"(",
"device",
"string",
")",
"error",
"{",
"return",
"c",
".",
"cr",
"(",
"device",
",",
"c",
".",
"mounts",
",",
"c",
".",
"paths",
")",
"\n",
"}"
] | // Reload mount table for a device | [
"Reload",
"mount",
"table",
"for",
"a",
"device"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/custom_mount.go#L54-L56 |
144,140 | libopenstorage/openstorage | cli/volumes.go | BlockVolumeCommands | func BlockVolumeCommands(name string) []cli.Command {
v := &volDriver{name: name}
blockCommands := []cli.Command{
{
Name: "attach",
Aliases: []string{"a"},
Usage: "Attach volume to specified path",
Action: v.volumeAttach,
Flags: []cli.Flag{
cli.StringFlag{
Name: "path,p",
Usage:... | go | func BlockVolumeCommands(name string) []cli.Command {
v := &volDriver{name: name}
blockCommands := []cli.Command{
{
Name: "attach",
Aliases: []string{"a"},
Usage: "Attach volume to specified path",
Action: v.volumeAttach,
Flags: []cli.Flag{
cli.StringFlag{
Name: "path,p",
Usage:... | [
"func",
"BlockVolumeCommands",
"(",
"name",
"string",
")",
"[",
"]",
"cli",
".",
"Command",
"{",
"v",
":=",
"&",
"volDriver",
"{",
"name",
":",
"name",
"}",
"\n\n",
"blockCommands",
":=",
"[",
"]",
"cli",
".",
"Command",
"{",
"{",
"Name",
":",
"\"",
... | // BlockVolumeCommands exports CLI comamnds for a Block VolumeDriver. | [
"BlockVolumeCommands",
"exports",
"CLI",
"comamnds",
"for",
"a",
"Block",
"VolumeDriver",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cli/volumes.go#L513-L540 |
144,141 | libopenstorage/openstorage | cli/volumes.go | FileVolumeCommands | func FileVolumeCommands(name string) []cli.Command {
v := &volDriver{name: name}
return baseVolumeCommand(v)
} | go | func FileVolumeCommands(name string) []cli.Command {
v := &volDriver{name: name}
return baseVolumeCommand(v)
} | [
"func",
"FileVolumeCommands",
"(",
"name",
"string",
")",
"[",
"]",
"cli",
".",
"Command",
"{",
"v",
":=",
"&",
"volDriver",
"{",
"name",
":",
"name",
"}",
"\n\n",
"return",
"baseVolumeCommand",
"(",
"v",
")",
"\n",
"}"
] | // FileVolumeCommands exports CLI comamnds for File VolumeDriver | [
"FileVolumeCommands",
"exports",
"CLI",
"comamnds",
"for",
"File",
"VolumeDriver"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cli/volumes.go#L543-L547 |
144,142 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | Lock | func (e *defaultStoreEnumerator) Lock(volumeID string) (interface{}, error) {
return e.kvdb.Lock(e.lockKey(volumeID))
} | go | func (e *defaultStoreEnumerator) Lock(volumeID string) (interface{}, error) {
return e.kvdb.Lock(e.lockKey(volumeID))
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"Lock",
"(",
"volumeID",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"e",
".",
"kvdb",
".",
"Lock",
"(",
"e",
".",
"lockKey",
"(",
"volumeID",
")",
")",
"\n",
"}... | // Lock volume specified by volumeID. | [
"Lock",
"volume",
"specified",
"by",
"volumeID",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L31-L33 |
144,143 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | Unlock | func (e *defaultStoreEnumerator) Unlock(token interface{}) error {
v, ok := token.(*kvdb.KVPair)
if !ok {
return fmt.Errorf("Invalid token of type %T", token)
}
return e.kvdb.Unlock(v)
} | go | func (e *defaultStoreEnumerator) Unlock(token interface{}) error {
v, ok := token.(*kvdb.KVPair)
if !ok {
return fmt.Errorf("Invalid token of type %T", token)
}
return e.kvdb.Unlock(v)
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"Unlock",
"(",
"token",
"interface",
"{",
"}",
")",
"error",
"{",
"v",
",",
"ok",
":=",
"token",
".",
"(",
"*",
"kvdb",
".",
"KVPair",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"E... | // Lock volume with token obtained from call to Lock. | [
"Lock",
"volume",
"with",
"token",
"obtained",
"from",
"call",
"to",
"Lock",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L36-L42 |
144,144 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | CreateVol | func (e *defaultStoreEnumerator) CreateVol(vol *api.Volume) error {
_, err := e.kvdb.Create(e.volKey(vol.Id), vol, 0)
return err
} | go | func (e *defaultStoreEnumerator) CreateVol(vol *api.Volume) error {
_, err := e.kvdb.Create(e.volKey(vol.Id), vol, 0)
return err
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"CreateVol",
"(",
"vol",
"*",
"api",
".",
"Volume",
")",
"error",
"{",
"_",
",",
"err",
":=",
"e",
".",
"kvdb",
".",
"Create",
"(",
"e",
".",
"volKey",
"(",
"vol",
".",
"Id",
")",
",",
"vol",
... | // CreateVol returns error if volume with the same ID already existe. | [
"CreateVol",
"returns",
"error",
"if",
"volume",
"with",
"the",
"same",
"ID",
"already",
"existe",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L45-L48 |
144,145 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | GetVol | func (e *defaultStoreEnumerator) GetVol(volumeID string) (*api.Volume, error) {
var v api.Volume
_, err := e.kvdb.GetVal(e.volKey(volumeID), &v)
return &v, err
} | go | func (e *defaultStoreEnumerator) GetVol(volumeID string) (*api.Volume, error) {
var v api.Volume
_, err := e.kvdb.GetVal(e.volKey(volumeID), &v)
return &v, err
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"GetVol",
"(",
"volumeID",
"string",
")",
"(",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"var",
"v",
"api",
".",
"Volume",
"\n",
"_",
",",
"err",
":=",
"e",
".",
"kvdb",
".",
"GetVal",
... | // GetVol from volumeID. | [
"GetVol",
"from",
"volumeID",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L51-L55 |
144,146 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | UpdateVol | func (e *defaultStoreEnumerator) UpdateVol(vol *api.Volume) error {
_, err := e.kvdb.Put(e.volKey(vol.Id), vol, 0)
return err
} | go | func (e *defaultStoreEnumerator) UpdateVol(vol *api.Volume) error {
_, err := e.kvdb.Put(e.volKey(vol.Id), vol, 0)
return err
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"UpdateVol",
"(",
"vol",
"*",
"api",
".",
"Volume",
")",
"error",
"{",
"_",
",",
"err",
":=",
"e",
".",
"kvdb",
".",
"Put",
"(",
"e",
".",
"volKey",
"(",
"vol",
".",
"Id",
")",
",",
"vol",
"... | // UpdateVol with vol | [
"UpdateVol",
"with",
"vol"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L58-L61 |
144,147 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | DeleteVol | func (e *defaultStoreEnumerator) DeleteVol(volumeID string) error {
_, err := e.kvdb.Delete(e.volKey(volumeID))
return err
} | go | func (e *defaultStoreEnumerator) DeleteVol(volumeID string) error {
_, err := e.kvdb.Delete(e.volKey(volumeID))
return err
} | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"DeleteVol",
"(",
"volumeID",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"e",
".",
"kvdb",
".",
"Delete",
"(",
"e",
".",
"volKey",
"(",
"volumeID",
")",
")",
"\n",
"return",
"err",
"\n",
... | // DeleteVol. Returns error if volume does not exist. | [
"DeleteVol",
".",
"Returns",
"error",
"if",
"volume",
"does",
"not",
"exist",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L64-L67 |
144,148 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | Inspect | func (e *defaultStoreEnumerator) Inspect(ids []string) ([]*api.Volume, error) {
volumes := make([]*api.Volume, 0, len(ids))
for _, id := range ids {
volume, err := e.GetVol(id)
// XXX Distinguish between ENOENT and an internal error from KVDB
if err != nil {
continue
}
volumes = append(volumes, volume)
... | go | func (e *defaultStoreEnumerator) Inspect(ids []string) ([]*api.Volume, error) {
volumes := make([]*api.Volume, 0, len(ids))
for _, id := range ids {
volume, err := e.GetVol(id)
// XXX Distinguish between ENOENT and an internal error from KVDB
if err != nil {
continue
}
volumes = append(volumes, volume)
... | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"Inspect",
"(",
"ids",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"volumes",
":=",
"make",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
",",
"0",
... | // Inspect specified volumes.
// Returns slice of volumes that were found. | [
"Inspect",
"specified",
"volumes",
".",
"Returns",
"slice",
"of",
"volumes",
"that",
"were",
"found",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L71-L82 |
144,149 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | Enumerate | func (e *defaultStoreEnumerator) Enumerate(
locator *api.VolumeLocator,
labels map[string]string,
) ([]*api.Volume, error) {
kvp, err := e.kvdb.Enumerate(e.volKeyPrefix())
if err != nil {
return nil, err
}
volumes := make([]*api.Volume, 0, len(kvp))
for _, v := range kvp {
elem := &api.Volume{}
if err := ... | go | func (e *defaultStoreEnumerator) Enumerate(
locator *api.VolumeLocator,
labels map[string]string,
) ([]*api.Volume, error) {
kvp, err := e.kvdb.Enumerate(e.volKeyPrefix())
if err != nil {
return nil, err
}
volumes := make([]*api.Volume, 0, len(kvp))
for _, v := range kvp {
elem := &api.Volume{}
if err := ... | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"Enumerate",
"(",
"locator",
"*",
"api",
".",
"VolumeLocator",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
")",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"kvp"... | // Enumerate volumes that map to the volumeLocator. Locator fields may be regexp.
// If locator fields are left blank, this will return all volumee. | [
"Enumerate",
"volumes",
"that",
"map",
"to",
"the",
"volumeLocator",
".",
"Locator",
"fields",
"may",
"be",
"regexp",
".",
"If",
"locator",
"fields",
"are",
"left",
"blank",
"this",
"will",
"return",
"all",
"volumee",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L86-L106 |
144,150 | libopenstorage/openstorage | volume/drivers/common/default_store_enumerator.go | SnapEnumerate | func (e *defaultStoreEnumerator) SnapEnumerate(
volumeIDs []string,
labels map[string]string,
) ([]*api.Volume, error) {
kvp, err := e.kvdb.Enumerate(e.volKeyPrefix())
if err != nil {
return nil, err
}
volumes := make([]*api.Volume, 0, len(kvp))
for _, v := range kvp {
elem := &api.Volume{}
if err := json.... | go | func (e *defaultStoreEnumerator) SnapEnumerate(
volumeIDs []string,
labels map[string]string,
) ([]*api.Volume, error) {
kvp, err := e.kvdb.Enumerate(e.volKeyPrefix())
if err != nil {
return nil, err
}
volumes := make([]*api.Volume, 0, len(kvp))
for _, v := range kvp {
elem := &api.Volume{}
if err := json.... | [
"func",
"(",
"e",
"*",
"defaultStoreEnumerator",
")",
"SnapEnumerate",
"(",
"volumeIDs",
"[",
"]",
"string",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
",",
")",
"(",
"[",
"]",
"*",
"api",
".",
"Volume",
",",
"error",
")",
"{",
"kvp",
",",
... | // SnapEnumerate for specified volume | [
"SnapEnumerate",
"for",
"specified",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/default_store_enumerator.go#L109-L133 |
144,151 | libopenstorage/openstorage | api/server/middleware_auth.go | NewAuthMiddleware | func NewAuthMiddleware(
s osecrets.Secrets,
authType secrets.AuthTokenProviders,
) (*authMiddleware, error) {
provider, err := secrets.NewAuth(
authType,
s,
)
if err != nil {
return nil, err
}
return &authMiddleware{provider}, nil
} | go | func NewAuthMiddleware(
s osecrets.Secrets,
authType secrets.AuthTokenProviders,
) (*authMiddleware, error) {
provider, err := secrets.NewAuth(
authType,
s,
)
if err != nil {
return nil, err
}
return &authMiddleware{provider}, nil
} | [
"func",
"NewAuthMiddleware",
"(",
"s",
"osecrets",
".",
"Secrets",
",",
"authType",
"secrets",
".",
"AuthTokenProviders",
",",
")",
"(",
"*",
"authMiddleware",
",",
"error",
")",
"{",
"provider",
",",
"err",
":=",
"secrets",
".",
"NewAuth",
"(",
"authType",
... | // NewAuthMiddleware returns a negroni implementation of an http middleware
// which will intercept the management APIs | [
"NewAuthMiddleware",
"returns",
"a",
"negroni",
"implementation",
"of",
"an",
"http",
"middleware",
"which",
"will",
"intercept",
"the",
"management",
"APIs"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/middleware_auth.go#L34-L46 |
144,152 | libopenstorage/openstorage | api/ownership.go | OwnershipSetUsernameFromContext | func OwnershipSetUsernameFromContext(ctx context.Context, srcOwnership *Ownership) *Ownership {
// Check if the context has information about the user. If not,
// then security is not enabled.
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Merge the previous acls which may have been set by the user
... | go | func OwnershipSetUsernameFromContext(ctx context.Context, srcOwnership *Ownership) *Ownership {
// Check if the context has information about the user. If not,
// then security is not enabled.
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Merge the previous acls which may have been set by the user
... | [
"func",
"OwnershipSetUsernameFromContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"srcOwnership",
"*",
"Ownership",
")",
"*",
"Ownership",
"{",
"// Check if the context has information about the user. If not,",
"// then security is not enabled.",
"if",
"userinfo",
",",
"... | // OwnershipSetUsernameFromContext is used to create a new ownership object for
// a volume. It takes an ownership value if passed in by the user, then
// sets the `owner` value to the user name referred to in the user context | [
"OwnershipSetUsernameFromContext",
"is",
"used",
"to",
"create",
"a",
"new",
"ownership",
"object",
"for",
"a",
"volume",
".",
"It",
"takes",
"an",
"ownership",
"value",
"if",
"passed",
"in",
"by",
"the",
"user",
"then",
"sets",
"the",
"owner",
"value",
"to"... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L36-L54 |
144,153 | libopenstorage/openstorage | api/ownership.go | IsPermittedByContext | func (o *Ownership) IsPermittedByContext(
ctx context.Context,
accessType Ownership_AccessType) bool {
// If no ownership is there then it is public
if o == nil {
return true
}
// Volume is not public, check permission
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check Access
return o.IsP... | go | func (o *Ownership) IsPermittedByContext(
ctx context.Context,
accessType Ownership_AccessType) bool {
// If no ownership is there then it is public
if o == nil {
return true
}
// Volume is not public, check permission
if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {
// Check Access
return o.IsP... | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"IsPermittedByContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessType",
"Ownership_AccessType",
")",
"bool",
"{",
"// If no ownership is there then it is public",
"if",
"o",
"==",
"nil",
"{",
"return",
"true",
"\n... | // IsPermittedByContext returns true if the user captured in
// the context has permission to access the resource | [
"IsPermittedByContext",
"returns",
"true",
"if",
"the",
"user",
"captured",
"in",
"the",
"context",
"has",
"permission",
"to",
"access",
"the",
"resource"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L58-L76 |
144,154 | libopenstorage/openstorage | api/ownership.go | IsPermitted | func (o *Ownership) IsPermitted(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
// There is no owner, so it is a public resource
if o.IsPublic() {
return true
}
// If we are missing user information then do not allow.
// It is ok for the the user claims to have an empty Groups setting
if user... | go | func (o *Ownership) IsPermitted(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
// There is no owner, so it is a public resource
if o.IsPublic() {
return true
}
// If we are missing user information then do not allow.
// It is ok for the the user claims to have an empty Groups setting
if user... | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"IsPermitted",
"(",
"user",
"*",
"auth",
".",
"UserInfo",
",",
"accessType",
"Ownership_AccessType",
",",
")",
"bool",
"{",
"// There is no owner, so it is a public resource",
"if",
"o",
".",
"IsPublic",
"(",
")",
"{",
... | // IsPermitted returns true if the user has access to the resource
// according to the ownership. If there is no owner, then it is public | [
"IsPermitted",
"returns",
"true",
"if",
"the",
"user",
"has",
"access",
"to",
"the",
"resource",
"according",
"to",
"the",
"ownership",
".",
"If",
"there",
"is",
"no",
"owner",
"then",
"it",
"is",
"public"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L80-L103 |
144,155 | libopenstorage/openstorage | api/ownership.go | GetGroups | func (o *Ownership) GetGroups() map[string]Ownership_AccessType {
if o.GetAcls() == nil {
return nil
}
return o.GetAcls().GetGroups()
} | go | func (o *Ownership) GetGroups() map[string]Ownership_AccessType {
if o.GetAcls() == nil {
return nil
}
return o.GetAcls().GetGroups()
} | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"GetGroups",
"(",
")",
"map",
"[",
"string",
"]",
"Ownership_AccessType",
"{",
"if",
"o",
".",
"GetAcls",
"(",
")",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"GetAcls",
"(",
")"... | // GetGroups returns the groups in the ownership | [
"GetGroups",
"returns",
"the",
"groups",
"in",
"the",
"ownership"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L106-L111 |
144,156 | libopenstorage/openstorage | api/ownership.go | GetCollaborators | func (o *Ownership) GetCollaborators() map[string]Ownership_AccessType {
if o.GetAcls() == nil {
return nil
}
return o.GetAcls().GetCollaborators()
} | go | func (o *Ownership) GetCollaborators() map[string]Ownership_AccessType {
if o.GetAcls() == nil {
return nil
}
return o.GetAcls().GetCollaborators()
} | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"GetCollaborators",
"(",
")",
"map",
"[",
"string",
"]",
"Ownership_AccessType",
"{",
"if",
"o",
".",
"GetAcls",
"(",
")",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"GetAcls",
"("... | // GetCollaborators returns the collaborators in the ownership | [
"GetCollaborators",
"returns",
"the",
"collaborators",
"in",
"the",
"ownership"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L114-L119 |
144,157 | libopenstorage/openstorage | api/ownership.go | IsUserAllowedByGroup | func (o *Ownership) IsUserAllowedByGroup(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
// Allow if it is the admin user for any group
if o.IsAdminByUser(user) {
return true
}
ownergroups := o.GetGroups()
if len(ownergroups) == 0 {
return false
}
// Check each of the groups from the use... | go | func (o *Ownership) IsUserAllowedByGroup(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
// Allow if it is the admin user for any group
if o.IsAdminByUser(user) {
return true
}
ownergroups := o.GetGroups()
if len(ownergroups) == 0 {
return false
}
// Check each of the groups from the use... | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"IsUserAllowedByGroup",
"(",
"user",
"*",
"auth",
".",
"UserInfo",
",",
"accessType",
"Ownership_AccessType",
",",
")",
"bool",
"{",
"// Allow if it is the admin user for any group",
"if",
"o",
".",
"IsAdminByUser",
"(",
"u... | // IsUserAllowedByGroup returns true if the user is allowed access
// by belonging to the appropriate group | [
"IsUserAllowedByGroup",
"returns",
"true",
"if",
"the",
"user",
"is",
"allowed",
"access",
"by",
"belonging",
"to",
"the",
"appropriate",
"group"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L123-L152 |
144,158 | libopenstorage/openstorage | api/ownership.go | IsUserAllowedByCollaborators | func (o *Ownership) IsUserAllowedByCollaborators(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
collaborators := o.GetCollaborators()
if len(collaborators) == 0 {
return false
}
// Check each of the groups from the user
if a, ok := collaborators[user.Username]; ok {
return a.isAccessPermitt... | go | func (o *Ownership) IsUserAllowedByCollaborators(
user *auth.UserInfo,
accessType Ownership_AccessType,
) bool {
collaborators := o.GetCollaborators()
if len(collaborators) == 0 {
return false
}
// Check each of the groups from the user
if a, ok := collaborators[user.Username]; ok {
return a.isAccessPermitt... | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"IsUserAllowedByCollaborators",
"(",
"user",
"*",
"auth",
".",
"UserInfo",
",",
"accessType",
"Ownership_AccessType",
",",
")",
"bool",
"{",
"collaborators",
":=",
"o",
".",
"GetCollaborators",
"(",
")",
"\n",
"if",
"... | // IsUserAllowedByCollaborators returns true if the user is allowed access
// because they are part of the collaborators list | [
"IsUserAllowedByCollaborators",
"returns",
"true",
"if",
"the",
"user",
"is",
"allowed",
"access",
"because",
"they",
"are",
"part",
"of",
"the",
"collaborators",
"list"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L156-L176 |
144,159 | libopenstorage/openstorage | api/ownership.go | IsOwner | func (o *Ownership) IsOwner(user *auth.UserInfo) bool {
return o.Owner == user.Username
} | go | func (o *Ownership) IsOwner(user *auth.UserInfo) bool {
return o.Owner == user.Username
} | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"IsOwner",
"(",
"user",
"*",
"auth",
".",
"UserInfo",
")",
"bool",
"{",
"return",
"o",
".",
"Owner",
"==",
"user",
".",
"Username",
"\n",
"}"
] | // IsOwner returns if the user is the owner of the resource | [
"IsOwner",
"returns",
"if",
"the",
"user",
"is",
"the",
"owner",
"of",
"the",
"resource"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L189-L191 |
144,160 | libopenstorage/openstorage | api/ownership.go | Update | func (o *Ownership) Update(newownerInfo *Ownership, user *auth.UserInfo) error {
if user == nil {
// There is no auth, just copy the whole thing
*o = *newownerInfo
} else {
// Auth is enabled
// Only the owner, user with access type admin,
// or admin can change the group
if user.Username != o.Owner &&
... | go | func (o *Ownership) Update(newownerInfo *Ownership, user *auth.UserInfo) error {
if user == nil {
// There is no auth, just copy the whole thing
*o = *newownerInfo
} else {
// Auth is enabled
// Only the owner, user with access type admin,
// or admin can change the group
if user.Username != o.Owner &&
... | [
"func",
"(",
"o",
"*",
"Ownership",
")",
"Update",
"(",
"newownerInfo",
"*",
"Ownership",
",",
"user",
"*",
"auth",
".",
"UserInfo",
")",
"error",
"{",
"if",
"user",
"==",
"nil",
"{",
"// There is no auth, just copy the whole thing",
"*",
"o",
"=",
"*",
"n... | // Update can be used to update an ownership with new ownership information. It
// takes into account who is trying to change the ownership values | [
"Update",
"can",
"be",
"used",
"to",
"update",
"an",
"ownership",
"with",
"new",
"ownership",
"information",
".",
"It",
"takes",
"into",
"account",
"who",
"is",
"trying",
"to",
"change",
"the",
"ownership",
"values"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L201-L229 |
144,161 | libopenstorage/openstorage | api/ownership.go | IsAdminByUser | func IsAdminByUser(user *auth.UserInfo) bool {
// If there is a user, then auth is enabled
if user != nil {
return listContains(user.Claims.Groups, AdminGroup)
}
// No auth enabled, so everyone is an admin
return true
} | go | func IsAdminByUser(user *auth.UserInfo) bool {
// If there is a user, then auth is enabled
if user != nil {
return listContains(user.Claims.Groups, AdminGroup)
}
// No auth enabled, so everyone is an admin
return true
} | [
"func",
"IsAdminByUser",
"(",
"user",
"*",
"auth",
".",
"UserInfo",
")",
"bool",
"{",
"// If there is a user, then auth is enabled",
"if",
"user",
"!=",
"nil",
"{",
"return",
"listContains",
"(",
"user",
".",
"Claims",
".",
"Groups",
",",
"AdminGroup",
")",
"\... | // IsAdminByUser returns true if the user is an ownership admin, meaning,
// that they belong to any group | [
"IsAdminByUser",
"returns",
"true",
"if",
"the",
"user",
"is",
"an",
"ownership",
"admin",
"meaning",
"that",
"they",
"belong",
"to",
"any",
"group"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/ownership.go#L278-L286 |
144,162 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | NewClient | func NewClient(cfg *VSphereConfig) (storageops.Ops, error) {
vSphereConn := &vclib.VSphereConnection{
Username: cfg.User,
Password: cfg.Password,
Hostname: cfg.VCenterIP,
Insecure: cfg.InsecureFlag,
RoundTripperCount: cfg.RoundTripperCount,
Port: cfg.VCenter... | go | func NewClient(cfg *VSphereConfig) (storageops.Ops, error) {
vSphereConn := &vclib.VSphereConnection{
Username: cfg.User,
Password: cfg.Password,
Hostname: cfg.VCenterIP,
Insecure: cfg.InsecureFlag,
RoundTripperCount: cfg.RoundTripperCount,
Port: cfg.VCenter... | [
"func",
"NewClient",
"(",
"cfg",
"*",
"VSphereConfig",
")",
"(",
"storageops",
".",
"Ops",
",",
"error",
")",
"{",
"vSphereConn",
":=",
"&",
"vclib",
".",
"VSphereConnection",
"{",
"Username",
":",
"cfg",
".",
"User",
",",
"Password",
":",
"cfg",
".",
... | // NewClient creates a new vsphere storageops instance | [
"NewClient",
"creates",
"a",
"new",
"vsphere",
"storageops",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L44-L71 |
144,163 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | Attach | func (ops *vsphereOps) Attach(diskPath string) (string, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
vmObj, err := ops.renewVM(ctx, ops.vm)
if err != nil {
return "", err
}
diskUUID, err := vmObj.AttachDisk(ctx, diskPath, &vclib.VolumeOptions{SCSIControllerType: vclib.PVSCSI... | go | func (ops *vsphereOps) Attach(diskPath string) (string, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
vmObj, err := ops.renewVM(ctx, ops.vm)
if err != nil {
return "", err
}
diskUUID, err := vmObj.AttachDisk(ctx, diskPath, &vclib.VolumeOptions{SCSIControllerType: vclib.PVSCSI... | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"Attach",
"(",
"diskPath",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
"c... | // Attach takes in the path of the vmdk file and returns where it is attached inside the vm instance | [
"Attach",
"takes",
"in",
"the",
"path",
"of",
"the",
"vmdk",
"file",
"and",
"returns",
"where",
"it",
"is",
"attached",
"inside",
"the",
"vm",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L174-L190 |
144,164 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | Delete | func (ops *vsphereOps) Delete(diskPath string) error {
return ops.deleteInternal(diskPath, ops.cfg.VMUUID)
} | go | func (ops *vsphereOps) Delete(diskPath string) error {
return ops.deleteInternal(diskPath, ops.cfg.VMUUID)
} | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"Delete",
"(",
"diskPath",
"string",
")",
"error",
"{",
"return",
"ops",
".",
"deleteInternal",
"(",
"diskPath",
",",
"ops",
".",
"cfg",
".",
"VMUUID",
")",
"\n",
"}"
] | // Delete virtual disk at given path | [
"Delete",
"virtual",
"disk",
"at",
"given",
"path"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L227-L229 |
144,165 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | Describe | func (ops *vsphereOps) Describe() (interface{}, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
return ops.renewVM(ctx, ops.vm)
} | go | func (ops *vsphereOps) Describe() (interface{}, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
return ops.renewVM(ctx, ops.vm)
} | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"Describe",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
"cancel",... | // Desribe an instance of the virtual machine object to which ops is connected to | [
"Desribe",
"an",
"instance",
"of",
"the",
"virtual",
"machine",
"object",
"to",
"which",
"ops",
"is",
"connected",
"to"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L268-L273 |
144,166 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | FreeDevices | func (ops *vsphereOps) FreeDevices(blockDeviceMappings []interface{}, rootDeviceName string) ([]string, error) {
return nil, storageops.ErrNotSupported
} | go | func (ops *vsphereOps) FreeDevices(blockDeviceMappings []interface{}, rootDeviceName string) ([]string, error) {
return nil, storageops.ErrNotSupported
} | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"FreeDevices",
"(",
"blockDeviceMappings",
"[",
"]",
"interface",
"{",
"}",
",",
"rootDeviceName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"nil",
",",
"storageops",
".",
"ErrNo... | // FreeDevices is not supported by this provider | [
"FreeDevices",
"is",
"not",
"supported",
"by",
"this",
"provider"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L276-L278 |
144,167 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | DevicePath | func (ops *vsphereOps) DevicePath(diskPath string) (string, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
vmObj, err := ops.renewVM(ctx, ops.vm)
if err != nil {
return "", err
}
attached, err := vmObj.IsDiskAttached(ctx, diskPath)
if err != nil {
return "", fmt.Errorf("fai... | go | func (ops *vsphereOps) DevicePath(diskPath string) (string, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
vmObj, err := ops.renewVM(ctx, ops.vm)
if err != nil {
return "", err
}
attached, err := vmObj.IsDiskAttached(ctx, diskPath)
if err != nil {
return "", fmt.Errorf("fai... | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"DevicePath",
"(",
"diskPath",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
... | // DevicePath for the given volume i.e path where it's attached | [
"DevicePath",
"for",
"the",
"given",
"volume",
"i",
".",
"e",
"path",
"where",
"it",
"s",
"attached"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L322-L348 |
144,168 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | Snapshot | func (ops *vsphereOps) Snapshot(volumeID string, readonly bool) (interface{}, error) {
return nil, storageops.ErrNotSupported
} | go | func (ops *vsphereOps) Snapshot(volumeID string, readonly bool) (interface{}, error) {
return nil, storageops.ErrNotSupported
} | [
"func",
"(",
"ops",
"*",
"vsphereOps",
")",
"Snapshot",
"(",
"volumeID",
"string",
",",
"readonly",
"bool",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"nil",
",",
"storageops",
".",
"ErrNotSupported",
"\n",
"}"
] | // Snapshot the volume with given volumeID | [
"Snapshot",
"the",
"volume",
"with",
"given",
"volumeID"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L358-L360 |
144,169 | libopenstorage/openstorage | pkg/storageops/vsphere/vsphere.go | GetVMObject | func GetVMObject(ctx context.Context, conn *vclib.VSphereConnection, vmUUID string) (*vclib.VirtualMachine, error) {
// TODO change impl below using multiple goroutines and sync.WaitGroup to make it faster
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := conn.Connect(ctx); err != nil... | go | func GetVMObject(ctx context.Context, conn *vclib.VSphereConnection, vmUUID string) (*vclib.VirtualMachine, error) {
// TODO change impl below using multiple goroutines and sync.WaitGroup to make it faster
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := conn.Connect(ctx); err != nil... | [
"func",
"GetVMObject",
"(",
"ctx",
"context",
".",
"Context",
",",
"conn",
"*",
"vclib",
".",
"VSphereConnection",
",",
"vmUUID",
"string",
")",
"(",
"*",
"vclib",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"// TODO change impl below using multiple goroutines ... | // GetVMObject fetches the VirtualMachine object corresponding to the given virtual machine uuid | [
"GetVMObject",
"fetches",
"the",
"VirtualMachine",
"object",
"corresponding",
"to",
"the",
"given",
"virtual",
"machine",
"uuid"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storageops/vsphere/vsphere.go#L383-L419 |
144,170 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | Create | func (p *SdkPolicyManager) Create(
ctx context.Context,
req *api.SdkOpenStoragePolicyCreateRequest,
) (*api.SdkOpenStoragePolicyCreateResponse, error) {
if req.GetStoragePolicy().GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
} else if req.GetStoragePolicy()... | go | func (p *SdkPolicyManager) Create(
ctx context.Context,
req *api.SdkOpenStoragePolicyCreateRequest,
) (*api.SdkOpenStoragePolicyCreateResponse, error) {
if req.GetStoragePolicy().GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
} else if req.GetStoragePolicy()... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyCreateResponse",
",",
"error",
")",
"{",
"... | // Create Storage policy | [
"Create",
"Storage",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L97-L128 |
144,171 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | Delete | func (p *SdkPolicyManager) Delete(
ctx context.Context,
req *api.SdkOpenStoragePolicyDeleteRequest,
) (*api.SdkOpenStoragePolicyDeleteResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
// retrive default storage policy details
insp... | go | func (p *SdkPolicyManager) Delete(
ctx context.Context,
req *api.SdkOpenStoragePolicyDeleteRequest,
) (*api.SdkOpenStoragePolicyDeleteResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
// retrive default storage policy details
insp... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyDeleteResponse",
",",
"error",
")",
"{",
"... | // Delete storage policy specified by name | [
"Delete",
"storage",
"policy",
"specified",
"by",
"name"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L190-L233 |
144,172 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | Inspect | func (p *SdkPolicyManager) Inspect(
ctx context.Context,
req *api.SdkOpenStoragePolicyInspectRequest,
) (*api.SdkOpenStoragePolicyInspectResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
kvp, err := p.kv.Get(prefixWithName(req.GetN... | go | func (p *SdkPolicyManager) Inspect(
ctx context.Context,
req *api.SdkOpenStoragePolicyInspectRequest,
) (*api.SdkOpenStoragePolicyInspectResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
kvp, err := p.kv.Get(prefixWithName(req.GetN... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyInspectResponse",
",",
"error",
")",
"{",
... | // Inspect storage policy specifed by name | [
"Inspect",
"storage",
"policy",
"specifed",
"by",
"name"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L236-L264 |
144,173 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | Enumerate | func (p *SdkPolicyManager) Enumerate(
ctx context.Context,
req *api.SdkOpenStoragePolicyEnumerateRequest,
) (*api.SdkOpenStoragePolicyEnumerateResponse, error) {
// get all keyValue pair at /storage/policy/policies
kvp, err := p.kv.Enumerate(policyPrefix + policyPath)
if err != nil {
return nil, status.Errorf(co... | go | func (p *SdkPolicyManager) Enumerate(
ctx context.Context,
req *api.SdkOpenStoragePolicyEnumerateRequest,
) (*api.SdkOpenStoragePolicyEnumerateResponse, error) {
// get all keyValue pair at /storage/policy/policies
kvp, err := p.kv.Enumerate(policyPrefix + policyPath)
if err != nil {
return nil, status.Errorf(co... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyEnumerateResponse",
",",
"error",
")",
... | // Enumerate all of storage policies | [
"Enumerate",
"all",
"of",
"storage",
"policies"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L267-L293 |
144,174 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | SetDefault | func (p *SdkPolicyManager) SetDefault(
ctx context.Context,
req *api.SdkOpenStoragePolicySetDefaultRequest,
) (*api.SdkOpenStoragePolicySetDefaultResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
// verify policy exists, before set... | go | func (p *SdkPolicyManager) SetDefault(
ctx context.Context,
req *api.SdkOpenStoragePolicySetDefaultRequest,
) (*api.SdkOpenStoragePolicySetDefaultResponse, error) {
if req.GetName() == "" {
return nil, status.Error(codes.InvalidArgument, "Must supply a Storage Policy Name")
}
// verify policy exists, before set... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"SetDefault",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicySetDefaultRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicySetDefaultResponse",
",",
"error",
")"... | // SetDefault storage policy | [
"SetDefault",
"storage",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L296-L336 |
144,175 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | Release | func (p *SdkPolicyManager) Release(
ctx context.Context,
req *api.SdkOpenStoragePolicyReleaseRequest,
) (*api.SdkOpenStoragePolicyReleaseResponse, error) {
policy, err := p.DefaultInspect(ctx, &api.SdkOpenStoragePolicyDefaultInspectRequest{})
if err != nil {
return nil, err
}
// only administrator can remove ... | go | func (p *SdkPolicyManager) Release(
ctx context.Context,
req *api.SdkOpenStoragePolicyReleaseRequest,
) (*api.SdkOpenStoragePolicyReleaseResponse, error) {
policy, err := p.DefaultInspect(ctx, &api.SdkOpenStoragePolicyDefaultInspectRequest{})
if err != nil {
return nil, err
}
// only administrator can remove ... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"Release",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyReleaseRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyReleaseResponse",
",",
"error",
")",
"{",
... | // Release storage policy if set as default | [
"Release",
"storage",
"policy",
"if",
"set",
"as",
"default"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L339-L364 |
144,176 | libopenstorage/openstorage | pkg/storagepolicy/sdkstoragepolicy.go | DefaultInspect | func (p *SdkPolicyManager) DefaultInspect(
ctx context.Context,
req *api.SdkOpenStoragePolicyDefaultInspectRequest,
) (*api.SdkOpenStoragePolicyDefaultInspectResponse, error) {
var policyName string
defaultPolicy := &api.SdkOpenStoragePolicyDefaultInspectResponse{}
_, err := p.kv.GetVal(defaultPath, &policyName)
... | go | func (p *SdkPolicyManager) DefaultInspect(
ctx context.Context,
req *api.SdkOpenStoragePolicyDefaultInspectRequest,
) (*api.SdkOpenStoragePolicyDefaultInspectResponse, error) {
var policyName string
defaultPolicy := &api.SdkOpenStoragePolicyDefaultInspectResponse{}
_, err := p.kv.GetVal(defaultPath, &policyName)
... | [
"func",
"(",
"p",
"*",
"SdkPolicyManager",
")",
"DefaultInspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkOpenStoragePolicyDefaultInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkOpenStoragePolicyDefaultInspectResponse",
",",
"e... | // DefaultInspect return default storeage policy details | [
"DefaultInspect",
"return",
"default",
"storeage",
"policy",
"details"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/storagepolicy/sdkstoragepolicy.go#L367-L400 |
144,177 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | Create | func (s *ClusterPairServer) Create(
ctx context.Context,
req *api.SdkClusterPairCreateRequest,
) (*api.SdkClusterPairCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetRequest() == nil {
return nil, status.Errorf(codes.... | go | func (s *ClusterPairServer) Create(
ctx context.Context,
req *api.SdkClusterPairCreateRequest,
) (*api.SdkClusterPairCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetRequest() == nil {
return nil, status.Errorf(codes.... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairCreateResponse",
",",
"error",
")",
"{",
"if",
"s",... | // Create a new cluster with remote pair | [
"Create",
"a",
"new",
"cluster",
"with",
"remote",
"pair"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L39-L60 |
144,178 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | Inspect | func (s *ClusterPairServer) Inspect(
ctx context.Context,
req *api.SdkClusterPairInspectRequest,
) (*api.SdkClusterPairInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetId()) == 0 {
return nil, status.Error(codes.... | go | func (s *ClusterPairServer) Inspect(
ctx context.Context,
req *api.SdkClusterPairInspectRequest,
) (*api.SdkClusterPairInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetId()) == 0 {
return nil, status.Error(codes.... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairInspectResponse",
",",
"error",
")",
"{",
"if",
"... | // Inspect information about a cluster pair | [
"Inspect",
"information",
"about",
"a",
"cluster",
"pair"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L63-L81 |
144,179 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | Enumerate | func (s *ClusterPairServer) Enumerate(
ctx context.Context,
req *api.SdkClusterPairEnumerateRequest,
) (*api.SdkClusterPairEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.cluster().EnumeratePairs()
if err != n... | go | func (s *ClusterPairServer) Enumerate(
ctx context.Context,
req *api.SdkClusterPairEnumerateRequest,
) (*api.SdkClusterPairEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.cluster().EnumeratePairs()
if err != n... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairEnumerateResponse",
",",
"error",
")",
"{",
"if... | // Enumerate returns list of cluster pairs | [
"Enumerate",
"returns",
"list",
"of",
"cluster",
"pairs"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L84-L99 |
144,180 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | GetToken | func (s *ClusterPairServer) GetToken(
ctx context.Context,
req *api.SdkClusterPairGetTokenRequest,
) (*api.SdkClusterPairGetTokenResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Check if admin user - only system.admin can get cluste... | go | func (s *ClusterPairServer) GetToken(
ctx context.Context,
req *api.SdkClusterPairGetTokenRequest,
) (*api.SdkClusterPairGetTokenResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
// Check if admin user - only system.admin can get cluste... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"GetToken",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairGetTokenRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairGetTokenResponse",
",",
"error",
")",
"{",
"if",
... | // GetToken gets the authentication token for this cluster | [
"GetToken",
"gets",
"the",
"authentication",
"token",
"for",
"this",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L102-L125 |
144,181 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | ResetToken | func (s *ClusterPairServer) ResetToken(
ctx context.Context,
req *api.SdkClusterPairResetTokenRequest,
) (*api.SdkClusterPairResetTokenResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.cluster().GetPairToken(true)
if err... | go | func (s *ClusterPairServer) ResetToken(
ctx context.Context,
req *api.SdkClusterPairResetTokenRequest,
) (*api.SdkClusterPairResetTokenResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
resp, err := s.cluster().GetPairToken(true)
if err... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"ResetToken",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairResetTokenRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairResetTokenResponse",
",",
"error",
")",
"{",
... | // ResetToken gets the authentication token for this cluster | [
"ResetToken",
"gets",
"the",
"authentication",
"token",
"for",
"this",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L128-L143 |
144,182 | libopenstorage/openstorage | api/server/sdk/cluster_pair.go | Delete | func (s *ClusterPairServer) Delete(
ctx context.Context,
req *api.SdkClusterPairDeleteRequest,
) (*api.SdkClusterPairDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetClusterId()) == 0 {
return nil, status.Error(co... | go | func (s *ClusterPairServer) Delete(
ctx context.Context,
req *api.SdkClusterPairDeleteRequest,
) (*api.SdkClusterPairDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetClusterId()) == 0 {
return nil, status.Error(co... | [
"func",
"(",
"s",
"*",
"ClusterPairServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkClusterPairDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkClusterPairDeleteResponse",
",",
"error",
")",
"{",
"if",
"s",... | // Delete removes the cluster pairing | [
"Delete",
"removes",
"the",
"cluster",
"pairing"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/cluster_pair.go#L146-L162 |
144,183 | libopenstorage/openstorage | cluster/cluster_not_supported.go | Inspect | func (m *NullClusterManager) Inspect(arg0 string) (api.Node, error) {
return api.Node{}, ErrNotImplemented
} | go | func (m *NullClusterManager) Inspect(arg0 string) (api.Node, error) {
return api.Node{}, ErrNotImplemented
} | [
"func",
"(",
"m",
"*",
"NullClusterManager",
")",
"Inspect",
"(",
"arg0",
"string",
")",
"(",
"api",
".",
"Node",
",",
"error",
")",
"{",
"return",
"api",
".",
"Node",
"{",
"}",
",",
"ErrNotImplemented",
"\n",
"}"
] | // NullClusterManager implementations
// Inspect | [
"NullClusterManager",
"implementations",
"Inspect"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/cluster_not_supported.go#L78-L80 |
144,184 | libopenstorage/openstorage | cluster/cluster_not_supported.go | Remove | func (m *NullClusterRemove) Remove(arg0 []api.Node, arg1 bool) error {
return ErrNotImplemented
} | go | func (m *NullClusterRemove) Remove(arg0 []api.Node, arg1 bool) error {
return ErrNotImplemented
} | [
"func",
"(",
"m",
"*",
"NullClusterRemove",
")",
"Remove",
"(",
"arg0",
"[",
"]",
"api",
".",
"Node",
",",
"arg1",
"bool",
")",
"error",
"{",
"return",
"ErrNotImplemented",
"\n",
"}"
] | // NullClusterRemove implementations
// Remove | [
"NullClusterRemove",
"implementations",
"Remove"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/cluster_not_supported.go#L169-L171 |
144,185 | libopenstorage/openstorage | cluster/cluster_not_supported.go | EnumerateAlerts | func (m *NullClusterAlerts) EnumerateAlerts(arg0, arg1 time.Time, arg2 api.ResourceType) (*api.Alerts, error) {
return nil, ErrNotImplemented
} | go | func (m *NullClusterAlerts) EnumerateAlerts(arg0, arg1 time.Time, arg2 api.ResourceType) (*api.Alerts, error) {
return nil, ErrNotImplemented
} | [
"func",
"(",
"m",
"*",
"NullClusterAlerts",
")",
"EnumerateAlerts",
"(",
"arg0",
",",
"arg1",
"time",
".",
"Time",
",",
"arg2",
"api",
".",
"ResourceType",
")",
"(",
"*",
"api",
".",
"Alerts",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotImplem... | // NullClusterAlerts implementations
// EnumerateAlerts | [
"NullClusterAlerts",
"implementations",
"EnumerateAlerts"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/cluster_not_supported.go#L193-L195 |
144,186 | libopenstorage/openstorage | cluster/cluster_not_supported.go | CreatePair | func (m *NullClusterPair) CreatePair(arg0 *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error) {
return nil, ErrNotImplemented
} | go | func (m *NullClusterPair) CreatePair(arg0 *api.ClusterPairCreateRequest) (*api.ClusterPairCreateResponse, error) {
return nil, ErrNotImplemented
} | [
"func",
"(",
"m",
"*",
"NullClusterPair",
")",
"CreatePair",
"(",
"arg0",
"*",
"api",
".",
"ClusterPairCreateRequest",
")",
"(",
"*",
"api",
".",
"ClusterPairCreateResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotImplemented",
"\n",
"}"
] | // NullClusterPair implementations
// CreatePair | [
"NullClusterPair",
"implementations",
"CreatePair"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/cluster_not_supported.go#L205-L207 |
144,187 | libopenstorage/openstorage | csi/controller.go | ControllerExpandVolume | func (s *OsdCsiServer) ControllerExpandVolume(
ctx context.Context,
req *csi.ControllerExpandVolumeRequest,
) (*csi.ControllerExpandVolumeResponse, error) {
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume id must be provided")
} else if req.GetCapacityRange() == nil {
re... | go | func (s *OsdCsiServer) ControllerExpandVolume(
ctx context.Context,
req *csi.ControllerExpandVolumeRequest,
) (*csi.ControllerExpandVolumeResponse, error) {
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume id must be provided")
} else if req.GetCapacityRange() == nil {
re... | [
"func",
"(",
"s",
"*",
"OsdCsiServer",
")",
"ControllerExpandVolume",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"csi",
".",
"ControllerExpandVolumeRequest",
",",
")",
"(",
"*",
"csi",
".",
"ControllerExpandVolumeResponse",
",",
"error",
")",
"{",... | // ControllerExpandVolume is a CSI API which resizes a volume | [
"ControllerExpandVolume",
"is",
"a",
"CSI",
"API",
"which",
"resizes",
"a",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/csi/controller.go#L396-L446 |
144,188 | libopenstorage/openstorage | cli/drivers.go | DriverCommands | func DriverCommands() []cli.Command {
commands := []cli.Command{
{
Name: "add",
Aliases: []string{"a"},
Usage: "add a new driver",
Action: driverAdd,
Flags: []cli.Flag{
cli.StringFlag{
Name: "name,n",
Usage: "Driver Name",
},
cli.StringFlag{
Name: "options,o",
U... | go | func DriverCommands() []cli.Command {
commands := []cli.Command{
{
Name: "add",
Aliases: []string{"a"},
Usage: "add a new driver",
Action: driverAdd,
Flags: []cli.Flag{
cli.StringFlag{
Name: "name,n",
Usage: "Driver Name",
},
cli.StringFlag{
Name: "options,o",
U... | [
"func",
"DriverCommands",
"(",
")",
"[",
"]",
"cli",
".",
"Command",
"{",
"commands",
":=",
"[",
"]",
"cli",
".",
"Command",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"Aliases",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Usage",
":",
"\... | // DriverCommands exports the list of CLI driver subcommands. | [
"DriverCommands",
"exports",
"the",
"list",
"of",
"CLI",
"driver",
"subcommands",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cli/drivers.go#L14-L40 |
144,189 | libopenstorage/openstorage | volume/drivers/buse/buse.go | Init | func Init(params map[string]string) (volume.VolumeDriver, error) {
nbdInit()
inst := &driver{
IODriver: volume.IONotSupported,
StoreEnumerator: common.NewDefaultStoreEnumerator(Name,
kvdb.Instance()),
StatsDriver: volume.StatsNotSupported,
QuiesceDriver: volume.QuiesceNotSupported,
CredsDriv... | go | func Init(params map[string]string) (volume.VolumeDriver, error) {
nbdInit()
inst := &driver{
IODriver: volume.IONotSupported,
StoreEnumerator: common.NewDefaultStoreEnumerator(Name,
kvdb.Instance()),
StatsDriver: volume.StatsNotSupported,
QuiesceDriver: volume.QuiesceNotSupported,
CredsDriv... | [
"func",
"Init",
"(",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"volume",
".",
"VolumeDriver",
",",
"error",
")",
"{",
"nbdInit",
"(",
")",
"\n\n",
"inst",
":=",
"&",
"driver",
"{",
"IODriver",
":",
"volume",
".",
"IONotSupported",
",",
... | // Init intialized the buse driver | [
"Init",
"intialized",
"the",
"buse",
"driver"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/buse/buse.go#L94-L137 |
144,190 | libopenstorage/openstorage | pkg/mount/deleted_mount.go | NewDeletedMounter | func NewDeletedMounter(
rootSubstring string,
mountImpl MountImpl,
) (*deletedMounter, error) {
devMounter, err := NewDeviceMounter([]string{"/dev/"}, mountImpl, nil, "")
if err != nil {
return nil, err
}
deletedMounts := make(DeviceMap)
for k, v := range devMounter.mounts {
if matchDeleted(rootSubstring, k... | go | func NewDeletedMounter(
rootSubstring string,
mountImpl MountImpl,
) (*deletedMounter, error) {
devMounter, err := NewDeviceMounter([]string{"/dev/"}, mountImpl, nil, "")
if err != nil {
return nil, err
}
deletedMounts := make(DeviceMap)
for k, v := range devMounter.mounts {
if matchDeleted(rootSubstring, k... | [
"func",
"NewDeletedMounter",
"(",
"rootSubstring",
"string",
",",
"mountImpl",
"MountImpl",
",",
")",
"(",
"*",
"deletedMounter",
",",
"error",
")",
"{",
"devMounter",
",",
"err",
":=",
"NewDeviceMounter",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
","... | // NewDeletedMounter returns a new deletedMounter | [
"NewDeletedMounter",
"returns",
"a",
"new",
"deletedMounter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/deleted_mount.go#L23-L46 |
144,191 | libopenstorage/openstorage | pkg/mount/deleted_mount.go | Unmount | func (m *deletedMounter) Unmount(
sourcePath string,
path string,
flags int,
timeout int,
opts map[string]string,
) error {
if sourcePath != AllDevices {
return fmt.Errorf("DeletedMounter accepts only %v as sourcePath",
AllDevices)
}
m.Lock()
defer m.Unlock()
failedUnmounts := make(DeviceMap)
for k, v... | go | func (m *deletedMounter) Unmount(
sourcePath string,
path string,
flags int,
timeout int,
opts map[string]string,
) error {
if sourcePath != AllDevices {
return fmt.Errorf("DeletedMounter accepts only %v as sourcePath",
AllDevices)
}
m.Lock()
defer m.Unlock()
failedUnmounts := make(DeviceMap)
for k, v... | [
"func",
"(",
"m",
"*",
"deletedMounter",
")",
"Unmount",
"(",
"sourcePath",
"string",
",",
"path",
"string",
",",
"flags",
"int",
",",
"timeout",
"int",
",",
"opts",
"map",
"[",
"string",
"]",
"string",
",",
")",
"error",
"{",
"if",
"sourcePath",
"!=",... | // Unmount all deleted mounts. | [
"Unmount",
"all",
"deleted",
"mounts",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/deleted_mount.go#L66-L97 |
144,192 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupCreate | func (d *driver) CloudBackupCreate(
input *api.CloudBackupCreateRequest,
) (*api.CloudBackupCreateResponse, error) {
name, _, err := d.cloudBackupCreate(input)
if err == nil {
resp := &api.CloudBackupCreateResponse{Name: name}
return resp, err
}
return nil, err
} | go | func (d *driver) CloudBackupCreate(
input *api.CloudBackupCreateRequest,
) (*api.CloudBackupCreateResponse, error) {
name, _, err := d.cloudBackupCreate(input)
if err == nil {
resp := &api.CloudBackupCreateResponse{Name: name}
return resp, err
}
return nil, err
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupCreate",
"(",
"input",
"*",
"api",
".",
"CloudBackupCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"CloudBackupCreateResponse",
",",
"error",
")",
"{",
"name",
",",
"_",
",",
"err",
":=",
"d",
".",
"cl... | // CloudBackupCreate uploads snapshot of a volume to the cloud | [
"CloudBackupCreate",
"uploads",
"snapshot",
"of",
"a",
"volume",
"to",
"the",
"cloud"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L465-L474 |
144,193 | libopenstorage/openstorage | volume/drivers/fake/fake.go | cloudBackupCreate | func (d *driver) cloudBackupCreate(input *api.CloudBackupCreateRequest) (string, string, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return "", "", err
}
// Get volume info
vols, err := d.Inspect([]string{input.VolumeID})
if err != nil {
return "", "", fmt... | go | func (d *driver) cloudBackupCreate(input *api.CloudBackupCreateRequest) (string, string, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return "", "", err
}
// Get volume info
vols, err := d.Inspect([]string{input.VolumeID})
if err != nil {
return "", "", fmt... | [
"func",
"(",
"d",
"*",
"driver",
")",
"cloudBackupCreate",
"(",
"input",
"*",
"api",
".",
"CloudBackupCreateRequest",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"// Confirm credential id",
"if",
"err",
":=",
"d",
".",
"CredsValidate",
"(",
... | // cloudBackupCreate uploads snapshot of a volume to the cloud and returns the
// backup task id | [
"cloudBackupCreate",
"uploads",
"snapshot",
"of",
"a",
"volume",
"to",
"the",
"cloud",
"and",
"returns",
"the",
"backup",
"task",
"id"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L478-L534 |
144,194 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupRestore | func (d *driver) CloudBackupRestore(
input *api.CloudBackupRestoreRequest,
) (*api.CloudBackupRestoreResponse, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return nil, err
}
backup, _, err := d.backupEntry(input.ID, api.CloudBackupOp)
if err != nil {
return ... | go | func (d *driver) CloudBackupRestore(
input *api.CloudBackupRestoreRequest,
) (*api.CloudBackupRestoreResponse, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return nil, err
}
backup, _, err := d.backupEntry(input.ID, api.CloudBackupOp)
if err != nil {
return ... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupRestore",
"(",
"input",
"*",
"api",
".",
"CloudBackupRestoreRequest",
",",
")",
"(",
"*",
"api",
".",
"CloudBackupRestoreResponse",
",",
"error",
")",
"{",
"// Confirm credential id",
"if",
"err",
":=",
"d",
... | // CloudBackupRestore downloads a cloud backup and restores it to a volume | [
"CloudBackupRestore",
"downloads",
"a",
"cloud",
"backup",
"and",
"restores",
"it",
"to",
"a",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L565-L622 |
144,195 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupDelete | func (d *driver) CloudBackupDelete(input *api.CloudBackupDeleteRequest) error {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return err
}
_, id, err := d.backupEntry(input.ID, api.CloudBackupOp)
if err != nil {
return err
}
//_, err := d.kv.Delete(backupsKeyPrefix ... | go | func (d *driver) CloudBackupDelete(input *api.CloudBackupDeleteRequest) error {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return err
}
_, id, err := d.backupEntry(input.ID, api.CloudBackupOp)
if err != nil {
return err
}
//_, err := d.kv.Delete(backupsKeyPrefix ... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupDelete",
"(",
"input",
"*",
"api",
".",
"CloudBackupDeleteRequest",
")",
"error",
"{",
"// Confirm credential id",
"if",
"err",
":=",
"d",
".",
"CredsValidate",
"(",
"input",
".",
"CredentialUUID",
")",
";",
... | // CloudBackupDelete deletes the specified backup in cloud | [
"CloudBackupDelete",
"deletes",
"the",
"specified",
"backup",
"in",
"cloud"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L625-L639 |
144,196 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupDeleteAll | func (d *driver) CloudBackupDeleteAll(input *api.CloudBackupDeleteAllRequest) error {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return err
}
// Get volume info
if len(input.SrcVolumeID) != 0 {
vols, err := d.Inspect([]string{input.SrcVolumeID})
if err != nil {
... | go | func (d *driver) CloudBackupDeleteAll(input *api.CloudBackupDeleteAllRequest) error {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return err
}
// Get volume info
if len(input.SrcVolumeID) != 0 {
vols, err := d.Inspect([]string{input.SrcVolumeID})
if err != nil {
... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupDeleteAll",
"(",
"input",
"*",
"api",
".",
"CloudBackupDeleteAllRequest",
")",
"error",
"{",
"// Confirm credential id",
"if",
"err",
":=",
"d",
".",
"CredsValidate",
"(",
"input",
".",
"CredentialUUID",
")",
"... | // CloudBackupDelete deletes all the backups for a given volume in cloud | [
"CloudBackupDelete",
"deletes",
"all",
"the",
"backups",
"for",
"a",
"given",
"volume",
"in",
"cloud"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L678-L724 |
144,197 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupSchedCreate | func (d *driver) CloudBackupSchedCreate(
input *api.CloudBackupSchedCreateRequest,
) (*api.CloudBackupSchedCreateResponse, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return nil, err
}
// Check volume
vols, err := d.Inspect([]string{input.SrcVolumeID})
if e... | go | func (d *driver) CloudBackupSchedCreate(
input *api.CloudBackupSchedCreateRequest,
) (*api.CloudBackupSchedCreateResponse, error) {
// Confirm credential id
if err := d.CredsValidate(input.CredentialUUID); err != nil {
return nil, err
}
// Check volume
vols, err := d.Inspect([]string{input.SrcVolumeID})
if e... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupSchedCreate",
"(",
"input",
"*",
"api",
".",
"CloudBackupSchedCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"CloudBackupSchedCreateResponse",
",",
"error",
")",
"{",
"// Confirm credential id",
"if",
"err",
":=... | // CloudBackupSchedCreate creates a schedule backup volume to cloud | [
"CloudBackupSchedCreate",
"creates",
"a",
"schedule",
"backup",
"volume",
"to",
"cloud"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L876-L915 |
144,198 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupSchedDelete | func (d *driver) CloudBackupSchedDelete(input *api.CloudBackupSchedDeleteRequest) error {
d.kv.Delete(schedPrefix + "/" + input.UUID)
return nil
} | go | func (d *driver) CloudBackupSchedDelete(input *api.CloudBackupSchedDeleteRequest) error {
d.kv.Delete(schedPrefix + "/" + input.UUID)
return nil
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupSchedDelete",
"(",
"input",
"*",
"api",
".",
"CloudBackupSchedDeleteRequest",
")",
"error",
"{",
"d",
".",
"kv",
".",
"Delete",
"(",
"schedPrefix",
"+",
"\"",
"\"",
"+",
"input",
".",
"UUID",
")",
"\n",
... | // CloudBackupSchedDelete delete a volume backup schedule to cloud | [
"CloudBackupSchedDelete",
"delete",
"a",
"volume",
"backup",
"schedule",
"to",
"cloud"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L918-L921 |
144,199 | libopenstorage/openstorage | volume/drivers/fake/fake.go | CloudBackupSchedEnumerate | func (d *driver) CloudBackupSchedEnumerate() (*api.CloudBackupSchedEnumerateResponse, error) {
kvp, err := d.kv.Enumerate(schedPrefix)
if err != nil {
return nil, err
}
schedules := make(map[string]api.CloudBackupScheduleInfo, len(kvp))
for _, v := range kvp {
elem := &fakeSchedules{}
if err := json.Unmarsha... | go | func (d *driver) CloudBackupSchedEnumerate() (*api.CloudBackupSchedEnumerateResponse, error) {
kvp, err := d.kv.Enumerate(schedPrefix)
if err != nil {
return nil, err
}
schedules := make(map[string]api.CloudBackupScheduleInfo, len(kvp))
for _, v := range kvp {
elem := &fakeSchedules{}
if err := json.Unmarsha... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CloudBackupSchedEnumerate",
"(",
")",
"(",
"*",
"api",
".",
"CloudBackupSchedEnumerateResponse",
",",
"error",
")",
"{",
"kvp",
",",
"err",
":=",
"d",
".",
"kv",
".",
"Enumerate",
"(",
"schedPrefix",
")",
"\n",
"if"... | // CloudBackupSchedEnumerate enumerates the configured backup schedules in the cluster | [
"CloudBackupSchedEnumerate",
"enumerates",
"the",
"configured",
"backup",
"schedules",
"in",
"the",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fake/fake.go#L924-L941 |
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.