id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
143,900 | libopenstorage/openstorage | api/server/sdk/node.go | Enumerate | func (s *NodeServer) Enumerate(
ctx context.Context,
req *api.SdkNodeEnumerateRequest,
) (*api.SdkNodeEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
c, err := s.cluster().Enumerate()
if err != nil {
return nil, status.Erro... | go | func (s *NodeServer) Enumerate(
ctx context.Context,
req *api.SdkNodeEnumerateRequest,
) (*api.SdkNodeEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
c, err := s.cluster().Enumerate()
if err != nil {
return nil, status.Erro... | [
"func",
"(",
"s",
"*",
"NodeServer",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkNodeEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkNodeEnumerateResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"c... | // Enumerate returns the ids of all the nodes in the cluster | [
"Enumerate",
"returns",
"the",
"ids",
"of",
"all",
"the",
"nodes",
"in",
"the",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/node.go#L39-L59 |
143,901 | libopenstorage/openstorage | api/server/sdk/node.go | Inspect | func (s *NodeServer) Inspect(
ctx context.Context,
req *api.SdkNodeInspectRequest,
) (*api.SdkNodeInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetNodeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, ... | go | func (s *NodeServer) Inspect(
ctx context.Context,
req *api.SdkNodeInspectRequest,
) (*api.SdkNodeInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetNodeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, ... | [
"func",
"(",
"s",
"*",
"NodeServer",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkNodeInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkNodeInspectResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster... | // Inspect returns information about a specific node | [
"Inspect",
"returns",
"information",
"about",
"a",
"specific",
"node"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/node.go#L62-L88 |
143,902 | libopenstorage/openstorage | pkg/auth/claims.go | getUsername | func getUsername(usernameClaim UsernameClaimType, claims *Claims) string {
switch usernameClaim {
case UsernameClaimTypeEmail:
return claims.Email
case UsernameClaimTypeName:
return claims.Name
}
return claims.Subject
} | go | func getUsername(usernameClaim UsernameClaimType, claims *Claims) string {
switch usernameClaim {
case UsernameClaimTypeEmail:
return claims.Email
case UsernameClaimTypeName:
return claims.Name
}
return claims.Subject
} | [
"func",
"getUsername",
"(",
"usernameClaim",
"UsernameClaimType",
",",
"claims",
"*",
"Claims",
")",
"string",
"{",
"switch",
"usernameClaim",
"{",
"case",
"UsernameClaimTypeEmail",
":",
"return",
"claims",
".",
"Email",
"\n",
"case",
"UsernameClaimTypeName",
":",
... | // utility function to get username | [
"utility",
"function",
"to",
"get",
"username"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/claims.go#L49-L57 |
143,903 | libopenstorage/openstorage | pkg/flexvolume/flexvolume.go | BytesToJSONOptions | func BytesToJSONOptions(value []byte) (map[string]string, error) {
if value == nil || len(value) == 0 {
return nil, nil
}
m := make(map[string]string)
if err := json.Unmarshal(value, &m); err != nil {
return nil, err
}
return m, nil
} | go | func BytesToJSONOptions(value []byte) (map[string]string, error) {
if value == nil || len(value) == 0 {
return nil, nil
}
m := make(map[string]string)
if err := json.Unmarshal(value, &m); err != nil {
return nil, err
}
return m, nil
} | [
"func",
"BytesToJSONOptions",
"(",
"value",
"[",
"]",
"byte",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"if",
"value",
"==",
"nil",
"||",
"len",
"(",
"value",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}... | // BytesToJSONOptions converts a JSON string to a map of JSON options. | [
"BytesToJSONOptions",
"converts",
"a",
"JSON",
"string",
"to",
"a",
"map",
"of",
"JSON",
"options",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/flexvolume/flexvolume.go#L38-L47 |
143,904 | libopenstorage/openstorage | pkg/flexvolume/flexvolume.go | JSONOptionsToBytes | func JSONOptionsToBytes(jsonOptions map[string]string) ([]byte, error) {
if jsonOptions == nil || len(jsonOptions) == 0 {
return nil, nil
}
return json.Marshal(jsonOptions)
} | go | func JSONOptionsToBytes(jsonOptions map[string]string) ([]byte, error) {
if jsonOptions == nil || len(jsonOptions) == 0 {
return nil, nil
}
return json.Marshal(jsonOptions)
} | [
"func",
"JSONOptionsToBytes",
"(",
"jsonOptions",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"jsonOptions",
"==",
"nil",
"||",
"len",
"(",
"jsonOptions",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"... | // JSONOptionsToBytes converts a map of JSON Options to a JSON string. | [
"JSONOptionsToBytes",
"converts",
"a",
"map",
"of",
"JSON",
"Options",
"to",
"a",
"JSON",
"string",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/flexvolume/flexvolume.go#L50-L55 |
143,905 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageAlertsHandler | func RegisterOpenStorageAlertsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageAlertsHandlerClient(ctx, mux, NewOpenStorageAlertsClient(conn))
} | go | func RegisterOpenStorageAlertsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageAlertsHandlerClient(ctx, mux, NewOpenStorageAlertsClient(conn))
} | [
"func",
"RegisterOpenStorageAlertsHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageAlertsHandlerClient",
"(",
"ctx",
",",
"... | // RegisterOpenStorageAlertsHandler registers the http handlers for service OpenStorageAlerts to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageAlertsHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageAlerts",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L1491-L1493 |
143,906 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageRoleHandler | func RegisterOpenStorageRoleHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageRoleHandlerClient(ctx, mux, NewOpenStorageRoleClient(conn))
} | go | func RegisterOpenStorageRoleHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageRoleHandlerClient(ctx, mux, NewOpenStorageRoleClient(conn))
} | [
"func",
"RegisterOpenStorageRoleHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageRoleHandlerClient",
"(",
"ctx",
",",
"mux"... | // RegisterOpenStorageRoleHandler registers the http handlers for service OpenStorageRole to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageRoleHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageRole",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L1602-L1604 |
143,907 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageIdentityHandler | func RegisterOpenStorageIdentityHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageIdentityHandlerClient(ctx, mux, NewOpenStorageIdentityClient(conn))
} | go | func RegisterOpenStorageIdentityHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageIdentityHandlerClient(ctx, mux, NewOpenStorageIdentityClient(conn))
} | [
"func",
"RegisterOpenStorageIdentityHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageIdentityHandlerClient",
"(",
"ctx",
",",... | // RegisterOpenStorageIdentityHandler registers the http handlers for service OpenStorageIdentity to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageIdentityHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageIdentity",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L1812-L1814 |
143,908 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageClusterHandlerFromEndpoint | func RegisterOpenStorageClusterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Printf... | go | func RegisterOpenStorageClusterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Printf... | [
"func",
"RegisterOpenStorageClusterHandlerFromEndpoint",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"endpoint",
"string",
",",
"opts",
"[",
"]",
"grpc",
".",
"DialOption",
")",
"(",
"err",
"error",
")",
"{",
"con... | // RegisterOpenStorageClusterHandlerFromEndpoint is same as RegisterOpenStorageClusterHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done. | [
"RegisterOpenStorageClusterHandlerFromEndpoint",
"is",
"same",
"as",
"RegisterOpenStorageClusterHandler",
"but",
"automatically",
"dials",
"to",
"endpoint",
"and",
"closes",
"the",
"connection",
"when",
"ctx",
"gets",
"done",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L1898-L1919 |
143,909 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageClusterHandler | func RegisterOpenStorageClusterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterHandlerClient(ctx, mux, NewOpenStorageClusterClient(conn))
} | go | func RegisterOpenStorageClusterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterHandlerClient(ctx, mux, NewOpenStorageClusterClient(conn))
} | [
"func",
"RegisterOpenStorageClusterHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageClusterHandlerClient",
"(",
"ctx",
",",
... | // RegisterOpenStorageClusterHandler registers the http handlers for service OpenStorageCluster to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageClusterHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageCluster",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L1923-L1925 |
143,910 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageClusterPairHandler | func RegisterOpenStorageClusterPairHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterPairHandlerClient(ctx, mux, NewOpenStorageClusterPairClient(conn))
} | go | func RegisterOpenStorageClusterPairHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterPairHandlerClient(ctx, mux, NewOpenStorageClusterPairClient(conn))
} | [
"func",
"RegisterOpenStorageClusterPairHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageClusterPairHandlerClient",
"(",
"ctx",
... | // RegisterOpenStorageClusterPairHandler registers the http handlers for service OpenStorageClusterPair to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageClusterPairHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageClusterPair",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L2001-L2003 |
143,911 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageClusterDomainsHandler | func RegisterOpenStorageClusterDomainsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterDomainsHandlerClient(ctx, mux, NewOpenStorageClusterDomainsClient(conn))
} | go | func RegisterOpenStorageClusterDomainsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageClusterDomainsHandlerClient(ctx, mux, NewOpenStorageClusterDomainsClient(conn))
} | [
"func",
"RegisterOpenStorageClusterDomainsHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageClusterDomainsHandlerClient",
"(",
"... | // RegisterOpenStorageClusterDomainsHandler registers the http handlers for service OpenStorageClusterDomains to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageClusterDomainsHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageClusterDomains",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L2244-L2246 |
143,912 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageNodeHandler | func RegisterOpenStorageNodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageNodeHandlerClient(ctx, mux, NewOpenStorageNodeClient(conn))
} | go | func RegisterOpenStorageNodeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageNodeHandlerClient(ctx, mux, NewOpenStorageNodeClient(conn))
} | [
"func",
"RegisterOpenStorageNodeHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageNodeHandlerClient",
"(",
"ctx",
",",
"mux"... | // RegisterOpenStorageNodeHandler registers the http handlers for service OpenStorageNode to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageNodeHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageNode",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L2421-L2423 |
143,913 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageVolumeHandler | func RegisterOpenStorageVolumeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageVolumeHandlerClient(ctx, mux, NewOpenStorageVolumeClient(conn))
} | go | func RegisterOpenStorageVolumeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageVolumeHandlerClient(ctx, mux, NewOpenStorageVolumeClient(conn))
} | [
"func",
"RegisterOpenStorageVolumeHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageVolumeHandlerClient",
"(",
"ctx",
",",
"... | // RegisterOpenStorageVolumeHandler registers the http handlers for service OpenStorageVolume to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageVolumeHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageVolume",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L2565-L2567 |
143,914 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageMountAttachHandler | func RegisterOpenStorageMountAttachHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageMountAttachHandlerClient(ctx, mux, NewOpenStorageMountAttachClient(conn))
} | go | func RegisterOpenStorageMountAttachHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageMountAttachHandlerClient(ctx, mux, NewOpenStorageMountAttachClient(conn))
} | [
"func",
"RegisterOpenStorageMountAttachHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageMountAttachHandlerClient",
"(",
"ctx",
... | // RegisterOpenStorageMountAttachHandler registers the http handlers for service OpenStorageMountAttach to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageMountAttachHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageMountAttach",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L3105-L3107 |
143,915 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageMigrateHandler | func RegisterOpenStorageMigrateHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageMigrateHandlerClient(ctx, mux, NewOpenStorageMigrateClient(conn))
} | go | func RegisterOpenStorageMigrateHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageMigrateHandlerClient(ctx, mux, NewOpenStorageMigrateClient(conn))
} | [
"func",
"RegisterOpenStorageMigrateHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageMigrateHandlerClient",
"(",
"ctx",
",",
... | // RegisterOpenStorageMigrateHandler registers the http handlers for service OpenStorageMigrate to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageMigrateHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageMigrate",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L3282-L3284 |
143,916 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageObjectstoreHandler | func RegisterOpenStorageObjectstoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageObjectstoreHandlerClient(ctx, mux, NewOpenStorageObjectstoreClient(conn))
} | go | func RegisterOpenStorageObjectstoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageObjectstoreHandlerClient(ctx, mux, NewOpenStorageObjectstoreClient(conn))
} | [
"func",
"RegisterOpenStorageObjectstoreHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageObjectstoreHandlerClient",
"(",
"ctx",
... | // RegisterOpenStorageObjectstoreHandler registers the http handlers for service OpenStorageObjectstore to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageObjectstoreHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageObjectstore",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L3426-L3428 |
143,917 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageCredentialsHandler | func RegisterOpenStorageCredentialsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageCredentialsHandlerClient(ctx, mux, NewOpenStorageCredentialsClient(conn))
} | go | func RegisterOpenStorageCredentialsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageCredentialsHandlerClient(ctx, mux, NewOpenStorageCredentialsClient(conn))
} | [
"func",
"RegisterOpenStorageCredentialsHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageCredentialsHandlerClient",
"(",
"ctx",
... | // RegisterOpenStorageCredentialsHandler registers the http handlers for service OpenStorageCredentials to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageCredentialsHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageCredentials",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L3603-L3605 |
143,918 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageSchedulePolicyHandler | func RegisterOpenStorageSchedulePolicyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageSchedulePolicyHandlerClient(ctx, mux, NewOpenStorageSchedulePolicyClient(conn))
} | go | func RegisterOpenStorageSchedulePolicyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageSchedulePolicyHandlerClient(ctx, mux, NewOpenStorageSchedulePolicyClient(conn))
} | [
"func",
"RegisterOpenStorageSchedulePolicyHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageSchedulePolicyHandlerClient",
"(",
"... | // RegisterOpenStorageSchedulePolicyHandler registers the http handlers for service OpenStorageSchedulePolicy to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageSchedulePolicyHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageSchedulePolicy",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L3813-L3815 |
143,919 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStorageCloudBackupHandler | func RegisterOpenStorageCloudBackupHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageCloudBackupHandlerClient(ctx, mux, NewOpenStorageCloudBackupClient(conn))
} | go | func RegisterOpenStorageCloudBackupHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStorageCloudBackupHandlerClient(ctx, mux, NewOpenStorageCloudBackupClient(conn))
} | [
"func",
"RegisterOpenStorageCloudBackupHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStorageCloudBackupHandlerClient",
"(",
"ctx",
... | // RegisterOpenStorageCloudBackupHandler registers the http handlers for service OpenStorageCloudBackup to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStorageCloudBackupHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStorageCloudBackup",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L4023-L4025 |
143,920 | libopenstorage/openstorage | api/api.pb.gw.go | RegisterOpenStoragePolicyHandler | func RegisterOpenStoragePolicyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStoragePolicyHandlerClient(ctx, mux, NewOpenStoragePolicyClient(conn))
} | go | func RegisterOpenStoragePolicyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterOpenStoragePolicyHandlerClient(ctx, mux, NewOpenStoragePolicyClient(conn))
} | [
"func",
"RegisterOpenStoragePolicyHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterOpenStoragePolicyHandlerClient",
"(",
"ctx",
",",
"... | // RegisterOpenStoragePolicyHandler registers the http handlers for service OpenStoragePolicy to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterOpenStoragePolicyHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"OpenStoragePolicy",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/api.pb.gw.go#L4464-L4466 |
143,921 | libopenstorage/openstorage | pkg/auth/token.go | TokenClaims | func TokenClaims(rawtoken string) (*Claims, error) {
parts := strings.Split(rawtoken, ".")
// There are supposed to be three parts for the token
if len(parts) < 3 {
return nil, fmt.Errorf("Token is invalid: %v", rawtoken)
}
// Access claims in the token
claimBytes, err := jwt.DecodeSegment(parts[1])
if err !... | go | func TokenClaims(rawtoken string) (*Claims, error) {
parts := strings.Split(rawtoken, ".")
// There are supposed to be three parts for the token
if len(parts) < 3 {
return nil, fmt.Errorf("Token is invalid: %v", rawtoken)
}
// Access claims in the token
claimBytes, err := jwt.DecodeSegment(parts[1])
if err !... | [
"func",
"TokenClaims",
"(",
"rawtoken",
"string",
")",
"(",
"*",
"Claims",
",",
"error",
")",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"rawtoken",
",",
"\"",
"\"",
")",
"\n\n",
"// There are supposed to be three parts for the token",
"if",
"len",
"(",... | // TokenClaims returns the claims for the raw JWT token. | [
"TokenClaims",
"returns",
"the",
"claims",
"for",
"the",
"raw",
"JWT",
"token",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/token.go#L40-L62 |
143,922 | libopenstorage/openstorage | pkg/auth/token.go | TokenIssuer | func TokenIssuer(rawtoken string) (string, error) {
claims, err := TokenClaims(rawtoken)
if err != nil {
return "", err
}
// Return issuer
if len(claims.Issuer) != 0 {
return claims.Issuer, nil
} else {
return "", fmt.Errorf("Issuer was not specified in the token")
}
} | go | func TokenIssuer(rawtoken string) (string, error) {
claims, err := TokenClaims(rawtoken)
if err != nil {
return "", err
}
// Return issuer
if len(claims.Issuer) != 0 {
return claims.Issuer, nil
} else {
return "", fmt.Errorf("Issuer was not specified in the token")
}
} | [
"func",
"TokenIssuer",
"(",
"rawtoken",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"claims",
",",
"err",
":=",
"TokenClaims",
"(",
"rawtoken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
... | // TokenIssuer returns the issuer for the raw JWT token. | [
"TokenIssuer",
"returns",
"the",
"issuer",
"for",
"the",
"raw",
"JWT",
"token",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/token.go#L65-L77 |
143,923 | libopenstorage/openstorage | pkg/auth/token.go | IsJwtToken | func IsJwtToken(authstring string) bool {
_, _, err := new(jwt.Parser).ParseUnverified(authstring, jwt.MapClaims{})
return err == nil
} | go | func IsJwtToken(authstring string) bool {
_, _, err := new(jwt.Parser).ParseUnverified(authstring, jwt.MapClaims{})
return err == nil
} | [
"func",
"IsJwtToken",
"(",
"authstring",
"string",
")",
"bool",
"{",
"_",
",",
"_",
",",
"err",
":=",
"new",
"(",
"jwt",
".",
"Parser",
")",
".",
"ParseUnverified",
"(",
"authstring",
",",
"jwt",
".",
"MapClaims",
"{",
"}",
")",
"\n",
"return",
"err"... | // IsJwtToken returns true if the provided string is a valid jwt token | [
"IsJwtToken",
"returns",
"true",
"if",
"the",
"provided",
"string",
"is",
"a",
"valid",
"jwt",
"token"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/token.go#L80-L83 |
143,924 | libopenstorage/openstorage | pkg/auth/token.go | Token | func Token(
claims *Claims,
signature *Signature,
options *Options,
) (string, error) {
mapclaims := jwt.MapClaims{
"sub": claims.Subject,
"iss": claims.Issuer,
"email": claims.Email,
"name": claims.Name,
"roles": claims.Roles,
"iat": time.Now().Add(-options.IATSubtract).Unix(),
"exp": optio... | go | func Token(
claims *Claims,
signature *Signature,
options *Options,
) (string, error) {
mapclaims := jwt.MapClaims{
"sub": claims.Subject,
"iss": claims.Issuer,
"email": claims.Email,
"name": claims.Name,
"roles": claims.Roles,
"iat": time.Now().Add(-options.IATSubtract).Unix(),
"exp": optio... | [
"func",
"Token",
"(",
"claims",
"*",
"Claims",
",",
"signature",
"*",
"Signature",
",",
"options",
"*",
"Options",
",",
")",
"(",
"string",
",",
"error",
")",
"{",
"mapclaims",
":=",
"jwt",
".",
"MapClaims",
"{",
"\"",
"\"",
":",
"claims",
".",
"Subj... | // Token returns a signed JWT containing the claims provided | [
"Token",
"returns",
"a",
"signed",
"JWT",
"containing",
"the",
"claims",
"provided"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/auth/token.go#L86-L111 |
143,925 | libopenstorage/openstorage | pkg/chaos/chaos.go | Add | func Add(pkg string, fn string, desc string) ID {
id := ID(atomic.AddInt32(&count, 1))
chaos[id] = &Chaos{ID: id, Pkg: pkg, Fn: fn, Desc: desc, Enabled: false}
return id
} | go | func Add(pkg string, fn string, desc string) ID {
id := ID(atomic.AddInt32(&count, 1))
chaos[id] = &Chaos{ID: id, Pkg: pkg, Fn: fn, Desc: desc, Enabled: false}
return id
} | [
"func",
"Add",
"(",
"pkg",
"string",
",",
"fn",
"string",
",",
"desc",
"string",
")",
"ID",
"{",
"id",
":=",
"ID",
"(",
"atomic",
".",
"AddInt32",
"(",
"&",
"count",
",",
"1",
")",
")",
"\n",
"chaos",
"[",
"id",
"]",
"=",
"&",
"Chaos",
"{",
"... | // Add new chaos point. The ID returned can be used to perform operations on this Chaos Point. | [
"Add",
"new",
"chaos",
"point",
".",
"The",
"ID",
"returned",
"can",
"be",
"used",
"to",
"perform",
"operations",
"on",
"this",
"Chaos",
"Point",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/chaos/chaos.go#L63-L67 |
143,926 | libopenstorage/openstorage | pkg/chaos/chaos.go | Enumerate | func Enumerate(pkg string) []Chaos {
ko := make([]Chaos, 0, 10)
for _, v := range chaos {
if pkg == "" || pkg == v.Pkg {
ko = append(ko, *v)
}
}
return ko
} | go | func Enumerate(pkg string) []Chaos {
ko := make([]Chaos, 0, 10)
for _, v := range chaos {
if pkg == "" || pkg == v.Pkg {
ko = append(ko, *v)
}
}
return ko
} | [
"func",
"Enumerate",
"(",
"pkg",
"string",
")",
"[",
"]",
"Chaos",
"{",
"ko",
":=",
"make",
"(",
"[",
"]",
"Chaos",
",",
"0",
",",
"10",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"chaos",
"{",
"if",
"pkg",
"==",
"\"",
"\"",
"||",
"pkg",... | // Enumerate all chaos points in the system for specified package.
// If the pkg is "" enumerate all chaos points. | [
"Enumerate",
"all",
"chaos",
"points",
"in",
"the",
"system",
"for",
"specified",
"package",
".",
"If",
"the",
"pkg",
"is",
"enumerate",
"all",
"chaos",
"points",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/chaos/chaos.go#L71-L80 |
143,927 | libopenstorage/openstorage | pkg/chaos/chaos.go | Enable | func Enable(id ID, when When, what Action) error {
if v, ok := chaos[id]; !ok {
return ErrNoEnt
} else {
v.Enabled = true
v.When = when
v.What = what
}
return nil
} | go | func Enable(id ID, when When, what Action) error {
if v, ok := chaos[id]; !ok {
return ErrNoEnt
} else {
v.Enabled = true
v.When = when
v.What = what
}
return nil
} | [
"func",
"Enable",
"(",
"id",
"ID",
",",
"when",
"When",
",",
"what",
"Action",
")",
"error",
"{",
"if",
"v",
",",
"ok",
":=",
"chaos",
"[",
"id",
"]",
";",
"!",
"ok",
"{",
"return",
"ErrNoEnt",
"\n",
"}",
"else",
"{",
"v",
".",
"Enabled",
"=",
... | // Enable chaos point identified by ID. | [
"Enable",
"chaos",
"point",
"identified",
"by",
"ID",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/chaos/chaos.go#L83-L92 |
143,928 | libopenstorage/openstorage | pkg/chaos/chaos.go | Disable | func Disable(id ID) error {
if v, ok := chaos[id]; !ok {
return ErrNoEnt
} else {
v.Enabled = false
}
return nil
} | go | func Disable(id ID) error {
if v, ok := chaos[id]; !ok {
return ErrNoEnt
} else {
v.Enabled = false
}
return nil
} | [
"func",
"Disable",
"(",
"id",
"ID",
")",
"error",
"{",
"if",
"v",
",",
"ok",
":=",
"chaos",
"[",
"id",
"]",
";",
"!",
"ok",
"{",
"return",
"ErrNoEnt",
"\n",
"}",
"else",
"{",
"v",
".",
"Enabled",
"=",
"false",
"\n",
"}",
"\n",
"return",
"nil",
... | // Disable chaos point identified by ID. | [
"Disable",
"chaos",
"point",
"identified",
"by",
"ID",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/chaos/chaos.go#L95-L102 |
143,929 | libopenstorage/openstorage | pkg/chaos/chaos.go | Now | func Now(id ID) error {
if !activated {
return nil
}
if v, ok := chaos[id]; ok && v.Enabled {
v.Count++
if v.When == Once ||
(v.Count%(r.Int()%10)) == 0 {
if v.What == Error {
return ErrChaos
}
} else {
panic(fmt.Sprintf("Chaos triggered panic"))
}
}
return nil
} | go | func Now(id ID) error {
if !activated {
return nil
}
if v, ok := chaos[id]; ok && v.Enabled {
v.Count++
if v.When == Once ||
(v.Count%(r.Int()%10)) == 0 {
if v.What == Error {
return ErrChaos
}
} else {
panic(fmt.Sprintf("Chaos triggered panic"))
}
}
return nil
} | [
"func",
"Now",
"(",
"id",
"ID",
")",
"error",
"{",
"if",
"!",
"activated",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"chaos",
"[",
"id",
"]",
";",
"ok",
"&&",
"v",
".",
"Enabled",
"{",
"v",
".",
"Count",
"++",
"\n",
... | // Now will trigger chaos point if it is enabled. | [
"Now",
"will",
"trigger",
"chaos",
"point",
"if",
"it",
"is",
"enabled",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/chaos/chaos.go#L105-L121 |
143,930 | libopenstorage/openstorage | api/flexvolume/flexvolume.go | StartFlexVolumeAPI | func StartFlexVolumeAPI(port uint16, defaultDriver string) error {
grpcServer := grpc.NewServer(grpc.MaxConcurrentStreams(math.MaxUint32))
flexvolume.RegisterAPIServer(grpcServer, flexvolume.NewAPIServer(newFlexVolumeClient(defaultDriver)))
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
if err != nil ... | go | func StartFlexVolumeAPI(port uint16, defaultDriver string) error {
grpcServer := grpc.NewServer(grpc.MaxConcurrentStreams(math.MaxUint32))
flexvolume.RegisterAPIServer(grpcServer, flexvolume.NewAPIServer(newFlexVolumeClient(defaultDriver)))
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
if err != nil ... | [
"func",
"StartFlexVolumeAPI",
"(",
"port",
"uint16",
",",
"defaultDriver",
"string",
")",
"error",
"{",
"grpcServer",
":=",
"grpc",
".",
"NewServer",
"(",
"grpc",
".",
"MaxConcurrentStreams",
"(",
"math",
".",
"MaxUint32",
")",
")",
"\n",
"flexvolume",
".",
... | // StartFlexVolumeAPI starts the flexvolume API on the given port. | [
"StartFlexVolumeAPI",
"starts",
"the",
"flexvolume",
"API",
"on",
"the",
"given",
"port",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/flexvolume/flexvolume.go#L146-L159 |
143,931 | libopenstorage/openstorage | api/server/sdk/volume_node_ops.go | Attach | func (s *VolumeServer) Attach(
ctx context.Context,
req *api.SdkVolumeAttachRequest,
) (*api.SdkVolumeAttachResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.... | go | func (s *VolumeServer) Attach(
ctx context.Context,
req *api.SdkVolumeAttachRequest,
) (*api.SdkVolumeAttachResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.... | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"Attach",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeAttachRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeAttachResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"clus... | // Attach volume to given node | [
"Attach",
"volume",
"to",
"given",
"node"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_node_ops.go#L31-L76 |
143,932 | libopenstorage/openstorage | api/server/sdk/volume_node_ops.go | Detach | func (s *VolumeServer) Detach(
ctx context.Context,
req *api.SdkVolumeDetachRequest,
) (*api.SdkVolumeDetachResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.... | go | func (s *VolumeServer) Detach(
ctx context.Context,
req *api.SdkVolumeDetachRequest,
) (*api.SdkVolumeDetachResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.... | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"Detach",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeDetachRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeDetachResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"clus... | // Detach function for volume node detach | [
"Detach",
"function",
"for",
"volume",
"node",
"detach"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_node_ops.go#L79-L118 |
143,933 | libopenstorage/openstorage | api/server/sdk/volume_node_ops.go | Mount | func (s *VolumeServer) Mount(
ctx context.Context,
req *api.SdkVolumeMountRequest,
) (*api.SdkVolumeMountResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Er... | go | func (s *VolumeServer) Mount(
ctx context.Context,
req *api.SdkVolumeMountRequest,
) (*api.SdkVolumeMountResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Er... | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"Mount",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeMountRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeMountResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"cluster... | // Mount function for volume node detach | [
"Mount",
"function",
"for",
"volume",
"node",
"detach"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_node_ops.go#L121-L152 |
143,934 | libopenstorage/openstorage | api/server/sdk/volume_node_ops.go | Unmount | func (s *VolumeServer) Unmount(
ctx context.Context,
req *api.SdkVolumeUnmountRequest,
) (*api.SdkVolumeUnmountResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, stat... | go | func (s *VolumeServer) Unmount(
ctx context.Context,
req *api.SdkVolumeUnmountRequest,
) (*api.SdkVolumeUnmountResponse, error) {
if s.cluster() == nil || s.driver(ctx) == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetVolumeId()) == 0 {
return nil, stat... | [
"func",
"(",
"s",
"*",
"VolumeServer",
")",
"Unmount",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkVolumeUnmountRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkVolumeUnmountResponse",
",",
"error",
")",
"{",
"if",
"s",
".",
"c... | // Unmount volume from given node | [
"Unmount",
"volume",
"from",
"given",
"node"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/volume_node_ops.go#L155-L199 |
143,935 | libopenstorage/openstorage | cli/graph.go | GraphDriverCommands | func GraphDriverCommands(name string) []cli.Command {
g := &graphDriver{name: name}
graphCommands := []cli.Command{
{
Name: "status",
Aliases: []string{"s"},
Usage: "Status on the usage of a Graph Driver",
Action: g.status,
},
}
return graphCommands
} | go | func GraphDriverCommands(name string) []cli.Command {
g := &graphDriver{name: name}
graphCommands := []cli.Command{
{
Name: "status",
Aliases: []string{"s"},
Usage: "Status on the usage of a Graph Driver",
Action: g.status,
},
}
return graphCommands
} | [
"func",
"GraphDriverCommands",
"(",
"name",
"string",
")",
"[",
"]",
"cli",
".",
"Command",
"{",
"g",
":=",
"&",
"graphDriver",
"{",
"name",
":",
"name",
"}",
"\n\n",
"graphCommands",
":=",
"[",
"]",
"cli",
".",
"Command",
"{",
"{",
"Name",
":",
"\""... | // GraphDriverCommands exports CLI comamnds for a GraphDriver. | [
"GraphDriverCommands",
"exports",
"CLI",
"comamnds",
"for",
"a",
"GraphDriver",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cli/graph.go#L18-L31 |
143,936 | libopenstorage/openstorage | api/server/sdk/server_interceptors.go | rwlockIntercepter | func (s *sdkGrpcServer) rwlockIntercepter(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
s.lock.RLock()
defer s.lock.RUnlock()
return handler(ctx, req)
} | go | func (s *sdkGrpcServer) rwlockIntercepter(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
s.lock.RLock()
defer s.lock.RUnlock()
return handler(ctx, req)
} | [
"func",
"(",
"s",
"*",
"sdkGrpcServer",
")",
"rwlockIntercepter",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"interface",
"{",
"}",
",",
"info",
"*",
"grpc",
".",
"UnaryServerInfo",
",",
"handler",
"grpc",
".",
"UnaryHandler",
",",
")",
"(",
"int... | // This interceptor provides a way to lock out any calls while we adjust the server | [
"This",
"interceptor",
"provides",
"a",
"way",
"to",
"lock",
"out",
"any",
"calls",
"while",
"we",
"adjust",
"the",
"server"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server_interceptors.go#L43-L53 |
143,937 | libopenstorage/openstorage | api/server/sdk/server_interceptors.go | auth | func (s *sdkGrpcServer) auth(ctx context.Context) (context.Context, error) {
// Obtain token from metadata in the context
token, err := grpc_auth.AuthFromMD(ctx, ContextMetadataTokenKey)
if err != nil {
return nil, err
}
// Determine issuer
issuer, err := auth.TokenIssuer(token)
if err != nil {
return nil, ... | go | func (s *sdkGrpcServer) auth(ctx context.Context) (context.Context, error) {
// Obtain token from metadata in the context
token, err := grpc_auth.AuthFromMD(ctx, ContextMetadataTokenKey)
if err != nil {
return nil, err
}
// Determine issuer
issuer, err := auth.TokenIssuer(token)
if err != nil {
return nil, ... | [
"func",
"(",
"s",
"*",
"sdkGrpcServer",
")",
"auth",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"// Obtain token from metadata in the context",
"token",
",",
"err",
":=",
"grpc_auth",
".",
"AuthFromMD",
... | // Authenticate user and add authorization information back in the context | [
"Authenticate",
"user",
"and",
"add",
"authorization",
"information",
"back",
"in",
"the",
"context"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/server_interceptors.go#L56-L88 |
143,938 | libopenstorage/openstorage | graph/graphdriver.go | Get | func Get(name string) (graphdriver.Driver, error) {
if v, ok := instances[name]; ok {
return v, nil
}
return nil, ErrDriverNotFound
} | go | func Get(name string) (graphdriver.Driver, error) {
if v, ok := instances[name]; ok {
return v, nil
}
return nil, ErrDriverNotFound
} | [
"func",
"Get",
"(",
"name",
"string",
")",
"(",
"graphdriver",
".",
"Driver",
",",
"error",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"instances",
"[",
"name",
"]",
";",
"ok",
"{",
"return",
"v",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"... | // Get returns an already registered driver | [
"Get",
"returns",
"an",
"already",
"registered",
"driver"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/graphdriver.go#L27-L32 |
143,939 | libopenstorage/openstorage | graph/graphdriver.go | New | func New(name, root string, options []string) (graphdriver.Driver, error) {
mutex.Lock()
defer mutex.Unlock()
if _, ok := instances[name]; ok {
return nil, ErrExist
}
if initFunc, exists := drivers[name]; exists {
driver, err := initFunc(root, options, nil, nil)
if err != nil {
return nil, err
}
ins... | go | func New(name, root string, options []string) (graphdriver.Driver, error) {
mutex.Lock()
defer mutex.Unlock()
if _, ok := instances[name]; ok {
return nil, ErrExist
}
if initFunc, exists := drivers[name]; exists {
driver, err := initFunc(root, options, nil, nil)
if err != nil {
return nil, err
}
ins... | [
"func",
"New",
"(",
"name",
",",
"root",
"string",
",",
"options",
"[",
"]",
"string",
")",
"(",
"graphdriver",
".",
"Driver",
",",
"error",
")",
"{",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
... | // New creates a new graphdriver interface | [
"New",
"creates",
"a",
"new",
"graphdriver",
"interface"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/graphdriver.go#L35-L52 |
143,940 | libopenstorage/openstorage | graph/graphdriver.go | Register | func Register(name string, initFunc InitFunc) error {
mutex.Lock()
defer mutex.Unlock()
if _, exists := drivers[name]; exists {
return ErrExist
}
drivers[name] = initFunc
return nil
} | go | func Register(name string, initFunc InitFunc) error {
mutex.Lock()
defer mutex.Unlock()
if _, exists := drivers[name]; exists {
return ErrExist
}
drivers[name] = initFunc
return nil
} | [
"func",
"Register",
"(",
"name",
"string",
",",
"initFunc",
"InitFunc",
")",
"error",
"{",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"exists",
":=",
"drivers",
"[",
"name",
"]",
";",
"exi... | // Register registers a graphdriver | [
"Register",
"registers",
"a",
"graphdriver"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/graph/graphdriver.go#L55-L63 |
143,941 | libopenstorage/openstorage | api/server/docker.go | addTokenMetadata | func addTokenMetadata(ctx context.Context, token string) context.Context {
md := metadata.New(map[string]string{
"authorization": "bearer " + token,
})
return metadata.NewOutgoingContext(ctx, md)
} | go | func addTokenMetadata(ctx context.Context, token string) context.Context {
md := metadata.New(map[string]string{
"authorization": "bearer " + token,
})
return metadata.NewOutgoingContext(ctx, md)
} | [
"func",
"addTokenMetadata",
"(",
"ctx",
"context",
".",
"Context",
",",
"token",
"string",
")",
"context",
".",
"Context",
"{",
"md",
":=",
"metadata",
".",
"New",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"+",
"toke... | // addTokenMetadata adds the token to a given context's metadata | [
"addTokenMetadata",
"adds",
"the",
"token",
"to",
"a",
"given",
"context",
"s",
"metadata"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/docker.go#L286-L291 |
143,942 | libopenstorage/openstorage | api/server/docker.go | secretTokenFromStore | func (d *driver) secretTokenFromStore(secret string) (string, error) {
if d.secretsStore == nil {
return "", fmt.Errorf("A secret was passed in, but no secrets provider has been initialized")
}
token, err := d.secretsStore.GetToken(secret, "")
if err != nil {
return "", err
}
return token, nil
} | go | func (d *driver) secretTokenFromStore(secret string) (string, error) {
if d.secretsStore == nil {
return "", fmt.Errorf("A secret was passed in, but no secrets provider has been initialized")
}
token, err := d.secretsStore.GetToken(secret, "")
if err != nil {
return "", err
}
return token, nil
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"secretTokenFromStore",
"(",
"secret",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"d",
".",
"secretsStore",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"... | // secretTokenFromStore pulls the token from the configured secret store for
// a given secret name and context. | [
"secretTokenFromStore",
"pulls",
"the",
"token",
"from",
"the",
"configured",
"secret",
"store",
"for",
"a",
"given",
"secret",
"name",
"and",
"context",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/docker.go#L295-L306 |
143,943 | libopenstorage/openstorage | volume/volume_not_supported.go | Stats | func (s *statsNotSupported) Stats(
volumeID string,
cumulative bool,
) (*api.Stats, error) {
return nil, ErrNotSupported
} | go | func (s *statsNotSupported) Stats(
volumeID string,
cumulative bool,
) (*api.Stats, error) {
return nil, ErrNotSupported
} | [
"func",
"(",
"s",
"*",
"statsNotSupported",
")",
"Stats",
"(",
"volumeID",
"string",
",",
"cumulative",
"bool",
",",
")",
"(",
"*",
"api",
".",
"Stats",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotSupported",
"\n",
"}"
] | // Stats returns stats | [
"Stats",
"returns",
"stats"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/volume_not_supported.go#L74-L79 |
143,944 | libopenstorage/openstorage | volume/volume_not_supported.go | CapacityUsage | func (s *statsNotSupported) CapacityUsage(
ID string,
) (*api.CapacityUsageResponse, error) {
return nil, ErrNotSupported
} | go | func (s *statsNotSupported) CapacityUsage(
ID string,
) (*api.CapacityUsageResponse, error) {
return nil, ErrNotSupported
} | [
"func",
"(",
"s",
"*",
"statsNotSupported",
")",
"CapacityUsage",
"(",
"ID",
"string",
",",
")",
"(",
"*",
"api",
".",
"CapacityUsageResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotSupported",
"\n",
"}"
] | // GetCapacityUsage gets exclusive and shared capacity
// usage of snap | [
"GetCapacityUsage",
"gets",
"exclusive",
"and",
"shared",
"capacity",
"usage",
"of",
"snap"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/volume_not_supported.go#L93-L97 |
143,945 | libopenstorage/openstorage | pkg/keylock/keylock.go | ByName | func ByName(klName string) KeyLock {
klLock.Lock()
defer klLock.Unlock()
kl, ok := klMap[klName]
if !ok {
kl = New()
klMap[klName] = kl
}
return kl
} | go | func ByName(klName string) KeyLock {
klLock.Lock()
defer klLock.Unlock()
kl, ok := klMap[klName]
if !ok {
kl = New()
klMap[klName] = kl
}
return kl
} | [
"func",
"ByName",
"(",
"klName",
"string",
")",
"KeyLock",
"{",
"klLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"klLock",
".",
"Unlock",
"(",
")",
"\n\n",
"kl",
",",
"ok",
":=",
"klMap",
"[",
"klName",
"]",
"\n",
"if",
"!",
"ok",
"{",
"kl",
"=",
... | // ByName creates a new instance or returns an existing instance
// if found in the map. | [
"ByName",
"creates",
"a",
"new",
"instance",
"or",
"returns",
"an",
"existing",
"instance",
"if",
"found",
"in",
"the",
"map",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/keylock/keylock.go#L67-L77 |
143,946 | libopenstorage/openstorage | alerts/filter.go | getUniqueKeysFromFilters | func getUniqueKeysFromFilters(filters ...Filter) (map[string]bool, error) {
keys := make(map[string]bool)
// sort filters so we know how to query
if len(filters) > 0 {
sort.Sort(Filters(filters))
for _, filter := range filters {
key := kvdbKey
switch filter.GetFilterType() {
// only these filter types... | go | func getUniqueKeysFromFilters(filters ...Filter) (map[string]bool, error) {
keys := make(map[string]bool)
// sort filters so we know how to query
if len(filters) > 0 {
sort.Sort(Filters(filters))
for _, filter := range filters {
key := kvdbKey
switch filter.GetFilterType() {
// only these filter types... | [
"func",
"getUniqueKeysFromFilters",
"(",
"filters",
"...",
"Filter",
")",
"(",
"map",
"[",
"string",
"]",
"bool",
",",
"error",
")",
"{",
"keys",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n\n",
"// sort filters so we know how to query",
"i... | // getUniqueKeysFromFilters analyzes filters and outputs a map of unique keys such that
// these keys do not point to sub trees of one another. | [
"getUniqueKeysFromFilters",
"analyzes",
"filters",
"and",
"outputs",
"a",
"map",
"of",
"unique",
"keys",
"such",
"that",
"these",
"keys",
"do",
"not",
"point",
"to",
"sub",
"trees",
"of",
"one",
"another",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/filter.go#L314-L378 |
143,947 | libopenstorage/openstorage | volume/drivers/nfs/nfs.go | getNewSnapVolName | func (d *driver) getNewSnapVolName(volumeID string) string {
return volumeID + "-" + strconv.FormatUint(uint64(time.Now().Unix()), 10)
} | go | func (d *driver) getNewSnapVolName(volumeID string) string {
return volumeID + "-" + strconv.FormatUint(uint64(time.Now().Unix()), 10)
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"getNewSnapVolName",
"(",
"volumeID",
"string",
")",
"string",
"{",
"return",
"volumeID",
"+",
"\"",
"\"",
"+",
"strconv",
".",
"FormatUint",
"(",
"uint64",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")... | //append unix time to volumeID | [
"append",
"unix",
"time",
"to",
"volumeID"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/nfs/nfs.go#L212-L214 |
143,948 | libopenstorage/openstorage | volume/drivers/common/common.go | NewVolume | func NewVolume(
volumeID string,
fsType api.FSType,
volumeLocator *api.VolumeLocator,
source *api.Source,
volumeSpec *api.VolumeSpec,
) *api.Volume {
return &api.Volume{
Id: volumeID,
Locator: volumeLocator,
Ctime: prototime.Now(),
Spec: volumeSpec,
Source: source,
LastScan: prototime.... | go | func NewVolume(
volumeID string,
fsType api.FSType,
volumeLocator *api.VolumeLocator,
source *api.Source,
volumeSpec *api.VolumeSpec,
) *api.Volume {
return &api.Volume{
Id: volumeID,
Locator: volumeLocator,
Ctime: prototime.Now(),
Spec: volumeSpec,
Source: source,
LastScan: prototime.... | [
"func",
"NewVolume",
"(",
"volumeID",
"string",
",",
"fsType",
"api",
".",
"FSType",
",",
"volumeLocator",
"*",
"api",
".",
"VolumeLocator",
",",
"source",
"*",
"api",
".",
"Source",
",",
"volumeSpec",
"*",
"api",
".",
"VolumeSpec",
",",
")",
"*",
"api",... | // NewVolume returns a new api.Volume for a driver Create call. | [
"NewVolume",
"returns",
"a",
"new",
"api",
".",
"Volume",
"for",
"a",
"driver",
"Create",
"call",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/common.go#L11-L29 |
143,949 | libopenstorage/openstorage | volume/drivers/common/common.go | NewDefaultStoreEnumerator | func NewDefaultStoreEnumerator(driver string, kvdb kvdb.Kvdb) volume.StoreEnumerator {
return newDefaultStoreEnumerator(driver, kvdb)
} | go | func NewDefaultStoreEnumerator(driver string, kvdb kvdb.Kvdb) volume.StoreEnumerator {
return newDefaultStoreEnumerator(driver, kvdb)
} | [
"func",
"NewDefaultStoreEnumerator",
"(",
"driver",
"string",
",",
"kvdb",
"kvdb",
".",
"Kvdb",
")",
"volume",
".",
"StoreEnumerator",
"{",
"return",
"newDefaultStoreEnumerator",
"(",
"driver",
",",
"kvdb",
")",
"\n",
"}"
] | // NewDefaultStoreEnumerator returns a default store enumerator | [
"NewDefaultStoreEnumerator",
"returns",
"a",
"default",
"store",
"enumerator"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/common/common.go#L32-L34 |
143,950 | libopenstorage/openstorage | api/server/sdk/schedule_policy.go | Create | func (s *SchedulePolicyServer) Create(
ctx context.Context,
req *api.SdkSchedulePolicyCreateRequest,
) (*api.SdkSchedulePolicyCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetSchedulePolicy() == nil {
return nil, stat... | go | func (s *SchedulePolicyServer) Create(
ctx context.Context,
req *api.SdkSchedulePolicyCreateRequest,
) (*api.SdkSchedulePolicyCreateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetSchedulePolicy() == nil {
return nil, stat... | [
"func",
"(",
"s",
"*",
"SchedulePolicyServer",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkSchedulePolicyCreateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkSchedulePolicyCreateResponse",
",",
"error",
")",
"{",
"if... | // Create method creates schedule policy | [
"Create",
"method",
"creates",
"schedule",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/schedule_policy.go#L40-L76 |
143,951 | libopenstorage/openstorage | api/server/sdk/schedule_policy.go | Update | func (s *SchedulePolicyServer) Update(
ctx context.Context,
req *api.SdkSchedulePolicyUpdateRequest,
) (*api.SdkSchedulePolicyUpdateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetSchedulePolicy() == nil {
return nil, stat... | go | func (s *SchedulePolicyServer) Update(
ctx context.Context,
req *api.SdkSchedulePolicyUpdateRequest,
) (*api.SdkSchedulePolicyUpdateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if req.GetSchedulePolicy() == nil {
return nil, stat... | [
"func",
"(",
"s",
"*",
"SchedulePolicyServer",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkSchedulePolicyUpdateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkSchedulePolicyUpdateResponse",
",",
"error",
")",
"{",
"if... | // Update method updates schedule policy | [
"Update",
"method",
"updates",
"schedule",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/schedule_policy.go#L79-L120 |
143,952 | libopenstorage/openstorage | api/server/sdk/schedule_policy.go | Delete | func (s *SchedulePolicyServer) Delete(
ctx context.Context,
req *api.SdkSchedulePolicyDeleteRequest,
) (*api.SdkSchedulePolicyDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.Erro... | go | func (s *SchedulePolicyServer) Delete(
ctx context.Context,
req *api.SdkSchedulePolicyDeleteRequest,
) (*api.SdkSchedulePolicyDeleteResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.Erro... | [
"func",
"(",
"s",
"*",
"SchedulePolicyServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkSchedulePolicyDeleteRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkSchedulePolicyDeleteResponse",
",",
"error",
")",
"{",
"if... | // Delete method deletes schedule policy | [
"Delete",
"method",
"deletes",
"schedule",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/schedule_policy.go#L123-L144 |
143,953 | libopenstorage/openstorage | api/server/sdk/schedule_policy.go | Enumerate | func (s *SchedulePolicyServer) Enumerate(
ctx context.Context,
req *api.SdkSchedulePolicyEnumerateRequest,
) (*api.SdkSchedulePolicyEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
policies, err := s.cluster().SchedPolicyEnume... | go | func (s *SchedulePolicyServer) Enumerate(
ctx context.Context,
req *api.SdkSchedulePolicyEnumerateRequest,
) (*api.SdkSchedulePolicyEnumerateResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
policies, err := s.cluster().SchedPolicyEnume... | [
"func",
"(",
"s",
"*",
"SchedulePolicyServer",
")",
"Enumerate",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkSchedulePolicyEnumerateRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkSchedulePolicyEnumerateResponse",
",",
"error",
")",
"... | // Enumerate method enumerates schedule policies | [
"Enumerate",
"method",
"enumerates",
"schedule",
"policies"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/schedule_policy.go#L147-L179 |
143,954 | libopenstorage/openstorage | api/server/sdk/schedule_policy.go | Inspect | func (s *SchedulePolicyServer) Inspect(
ctx context.Context,
req *api.SdkSchedulePolicyInspectRequest,
) (*api.SdkSchedulePolicyInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.E... | go | func (s *SchedulePolicyServer) Inspect(
ctx context.Context,
req *api.SdkSchedulePolicyInspectRequest,
) (*api.SdkSchedulePolicyInspectResponse, error) {
if s.cluster() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
if len(req.GetName()) == 0 {
return nil, status.E... | [
"func",
"(",
"s",
"*",
"SchedulePolicyServer",
")",
"Inspect",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"api",
".",
"SdkSchedulePolicyInspectRequest",
",",
")",
"(",
"*",
"api",
".",
"SdkSchedulePolicyInspectResponse",
",",
"error",
")",
"{",
... | // Inspect method inspects schedule policy | [
"Inspect",
"method",
"inspects",
"schedule",
"policy"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/schedule_policy.go#L182-L219 |
143,955 | libopenstorage/openstorage | pkg/mount/device.go | NewDeviceMounter | func NewDeviceMounter(
devPrefixes []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*deviceMounter, error) {
m := &deviceMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: ... | go | func NewDeviceMounter(
devPrefixes []string,
mountImpl MountImpl,
allowedDirs []string,
trashLocation string,
) (*deviceMounter, error) {
m := &deviceMounter{
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: ... | [
"func",
"NewDeviceMounter",
"(",
"devPrefixes",
"[",
"]",
"string",
",",
"mountImpl",
"MountImpl",
",",
"allowedDirs",
"[",
"]",
"string",
",",
"trashLocation",
"string",
",",
")",
"(",
"*",
"deviceMounter",
",",
"error",
")",
"{",
"m",
":=",
"&",
"deviceM... | // NewDeviceMounter returns a new deviceMounter | [
"NewDeviceMounter",
"returns",
"a",
"new",
"deviceMounter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/device.go#L20-L49 |
143,956 | libopenstorage/openstorage | pkg/mount/device.go | Reload | func (m *deviceMounter) Reload(device string) error {
newDm, err := NewDeviceMounter([]string{device},
m.mountImpl,
m.Mounter.allowedDirs,
m.trashLocation,
)
if err != nil {
return err
}
return m.reload(device, newDm.mounts[device])
} | go | func (m *deviceMounter) Reload(device string) error {
newDm, err := NewDeviceMounter([]string{device},
m.mountImpl,
m.Mounter.allowedDirs,
m.trashLocation,
)
if err != nil {
return err
}
return m.reload(device, newDm.mounts[device])
} | [
"func",
"(",
"m",
"*",
"deviceMounter",
")",
"Reload",
"(",
"device",
"string",
")",
"error",
"{",
"newDm",
",",
"err",
":=",
"NewDeviceMounter",
"(",
"[",
"]",
"string",
"{",
"device",
"}",
",",
"m",
".",
"mountImpl",
",",
"m",
".",
"Mounter",
".",
... | // Reload reloads the mount table | [
"Reload",
"reloads",
"the",
"mount",
"table"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/device.go#L52-L62 |
143,957 | libopenstorage/openstorage | volume/drivers/fuse/fuse.go | NewVolumeDriver | func NewVolumeDriver(name string, baseDirPath string, provider Provider) volume.VolumeDriver {
return newVolumeDriver(name, baseDirPath, provider)
} | go | func NewVolumeDriver(name string, baseDirPath string, provider Provider) volume.VolumeDriver {
return newVolumeDriver(name, baseDirPath, provider)
} | [
"func",
"NewVolumeDriver",
"(",
"name",
"string",
",",
"baseDirPath",
"string",
",",
"provider",
"Provider",
")",
"volume",
".",
"VolumeDriver",
"{",
"return",
"newVolumeDriver",
"(",
"name",
",",
"baseDirPath",
",",
"provider",
")",
"\n",
"}"
] | // NewVolumeDriver creates a new volume.VolumeDriver for fuse. | [
"NewVolumeDriver",
"creates",
"a",
"new",
"volume",
".",
"VolumeDriver",
"for",
"fuse",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/volume/drivers/fuse/fuse.go#L17-L19 |
143,958 | libopenstorage/openstorage | pkg/mount/nfs.go | NewNFSMounter | func NewNFSMounter(servers []string,
mountImpl MountImpl,
allowedDirs []string,
) (Manager, error) {
m := &nfsMounter{
servers: servers,
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: keylock.New(),
},
}... | go | func NewNFSMounter(servers []string,
mountImpl MountImpl,
allowedDirs []string,
) (Manager, error) {
m := &nfsMounter{
servers: servers,
Mounter: Mounter{
mountImpl: mountImpl,
mounts: make(DeviceMap),
paths: make(PathMap),
allowedDirs: allowedDirs,
kl: keylock.New(),
},
}... | [
"func",
"NewNFSMounter",
"(",
"servers",
"[",
"]",
"string",
",",
"mountImpl",
"MountImpl",
",",
"allowedDirs",
"[",
"]",
"string",
",",
")",
"(",
"Manager",
",",
"error",
")",
"{",
"m",
":=",
"&",
"nfsMounter",
"{",
"servers",
":",
"servers",
",",
"Mo... | // NewnfsMounter returns a Mounter specific to parse NFS mounts. This can work
// VFS also if 'servers' is nil. Use NFSAllServers if the destination server
// is unknown. | [
"NewnfsMounter",
"returns",
"a",
"Mounter",
"specific",
"to",
"parse",
"NFS",
"mounts",
".",
"This",
"can",
"work",
"VFS",
"also",
"if",
"servers",
"is",
"nil",
".",
"Use",
"NFSAllServers",
"if",
"the",
"destination",
"server",
"is",
"unknown",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/nfs.go#L28-L47 |
143,959 | libopenstorage/openstorage | pkg/mount/nfs.go | serverExists | func (m *nfsMounter) serverExists(server string) bool {
for _, v := range m.servers {
if v == server || v == NFSAllServers {
return true
}
}
return false
} | go | func (m *nfsMounter) serverExists(server string) bool {
for _, v := range m.servers {
if v == server || v == NFSAllServers {
return true
}
}
return false
} | [
"func",
"(",
"m",
"*",
"nfsMounter",
")",
"serverExists",
"(",
"server",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"m",
".",
"servers",
"{",
"if",
"v",
"==",
"server",
"||",
"v",
"==",
"NFSAllServers",
"{",
"return",
"true",
... | //serverExists utility function to test if a server is part of driver config | [
"serverExists",
"utility",
"function",
"to",
"test",
"if",
"a",
"server",
"is",
"part",
"of",
"driver",
"config"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/mount/nfs.go#L68-L75 |
143,960 | libopenstorage/openstorage | pkg/dbg/profile_dump.go | DumpGoMemoryTrace | func DumpGoMemoryTrace() {
m := &runtime.MemStats{}
runtime.ReadMemStats(m)
res := fmt.Sprintf("%#v", m)
logrus.Infof("==== Dumping Memory Profile ===")
logrus.Infof(res)
} | go | func DumpGoMemoryTrace() {
m := &runtime.MemStats{}
runtime.ReadMemStats(m)
res := fmt.Sprintf("%#v", m)
logrus.Infof("==== Dumping Memory Profile ===")
logrus.Infof(res)
} | [
"func",
"DumpGoMemoryTrace",
"(",
")",
"{",
"m",
":=",
"&",
"runtime",
".",
"MemStats",
"{",
"}",
"\n",
"runtime",
".",
"ReadMemStats",
"(",
"m",
")",
"\n",
"res",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
")",
"\n",
"logrus",
".",
... | // DumpGoMemoryTrace output memory profile to logs. | [
"DumpGoMemoryTrace",
"output",
"memory",
"profile",
"to",
"logs",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/dbg/profile_dump.go#L20-L26 |
143,961 | libopenstorage/openstorage | pkg/dbg/profile_dump.go | DumpGoProfile | func DumpGoProfile() error {
trace := make([]byte, 5120*1024)
len := runtime.Stack(trace, true)
return ioutil.WriteFile(path+time.Now().Format(fnameFmt)+".stack", trace[:len], 0644)
} | go | func DumpGoProfile() error {
trace := make([]byte, 5120*1024)
len := runtime.Stack(trace, true)
return ioutil.WriteFile(path+time.Now().Format(fnameFmt)+".stack", trace[:len], 0644)
} | [
"func",
"DumpGoProfile",
"(",
")",
"error",
"{",
"trace",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"5120",
"*",
"1024",
")",
"\n",
"len",
":=",
"runtime",
".",
"Stack",
"(",
"trace",
",",
"true",
")",
"\n",
"return",
"ioutil",
".",
"WriteFile",
"(... | // DumpGoProfile output goroutines to file. | [
"DumpGoProfile",
"output",
"goroutines",
"to",
"file",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/dbg/profile_dump.go#L29-L33 |
143,962 | libopenstorage/openstorage | pkg/dbg/log.go | Panicf | func Panicf(format string, args ...interface{}) {
logrus.Warnf(format, args...)
err := DumpGoProfile()
if err != nil {
logrus.Fatal(err)
}
DumpHeap()
os.Exit(6)
} | go | func Panicf(format string, args ...interface{}) {
logrus.Warnf(format, args...)
err := DumpGoProfile()
if err != nil {
logrus.Fatal(err)
}
DumpHeap()
os.Exit(6)
} | [
"func",
"Panicf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"logrus",
".",
"Warnf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"err",
":=",
"DumpGoProfile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logr... | // Panicf outputs error message, dumps threads and exits. | [
"Panicf",
"outputs",
"error",
"message",
"dumps",
"threads",
"and",
"exits",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/dbg/log.go#L10-L18 |
143,963 | libopenstorage/openstorage | pkg/dbg/log.go | Assert | func Assert(condition bool, format string, args ...interface{}) {
if !condition {
Panicf(format, args...)
}
} | go | func Assert(condition bool, format string, args ...interface{}) {
if !condition {
Panicf(format, args...)
}
} | [
"func",
"Assert",
"(",
"condition",
"bool",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"!",
"condition",
"{",
"Panicf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] | // Assert Panicf's if the condition evaluates to false. | [
"Assert",
"Panicf",
"s",
"if",
"the",
"condition",
"evaluates",
"to",
"false",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/dbg/log.go#L21-L25 |
143,964 | libopenstorage/openstorage | pkg/device/device.go | NewSingleLetter | func NewSingleLetter(devPrefix, devices string) (*SingleLetter, error) {
s := &SingleLetter{
devPrefix: devPrefix,
devices: devices,
}
return s, nil
} | go | func NewSingleLetter(devPrefix, devices string) (*SingleLetter, error) {
s := &SingleLetter{
devPrefix: devPrefix,
devices: devices,
}
return s, nil
} | [
"func",
"NewSingleLetter",
"(",
"devPrefix",
",",
"devices",
"string",
")",
"(",
"*",
"SingleLetter",
",",
"error",
")",
"{",
"s",
":=",
"&",
"SingleLetter",
"{",
"devPrefix",
":",
"devPrefix",
",",
"devices",
":",
"devices",
",",
"}",
"\n",
"return",
"s... | // NewSingleLetter instance of Matrix | [
"NewSingleLetter",
"instance",
"of",
"Matrix"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/device/device.go#L40-L46 |
143,965 | libopenstorage/openstorage | pkg/device/device.go | Assign | func (s *SingleLetter) Assign() (string, error) {
s.Lock()
defer s.Unlock()
if len(s.devices) == 0 {
return "", fmt.Errorf("No free device IDs")
}
device := s.devPrefix + s.devices[:1]
s.devices = s.devices[1:]
return device, nil
} | go | func (s *SingleLetter) Assign() (string, error) {
s.Lock()
defer s.Unlock()
if len(s.devices) == 0 {
return "", fmt.Errorf("No free device IDs")
}
device := s.devPrefix + s.devices[:1]
s.devices = s.devices[1:]
return device, nil
} | [
"func",
"(",
"s",
"*",
"SingleLetter",
")",
"Assign",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"s",
".",
"devices",
")",
"==",
"0",
"{",
... | // Assign new device letter | [
"Assign",
"new",
"device",
"letter"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/device/device.go#L49-L58 |
143,966 | libopenstorage/openstorage | pkg/device/device.go | Release | func (s *SingleLetter) Release(dev string) error {
s.Lock()
defer s.Unlock()
if !strings.HasPrefix(dev, s.devPrefix) {
return ErrEinval
}
dev = dev[len(s.devPrefix):]
s.devices += dev
return nil
} | go | func (s *SingleLetter) Release(dev string) error {
s.Lock()
defer s.Unlock()
if !strings.HasPrefix(dev, s.devPrefix) {
return ErrEinval
}
dev = dev[len(s.devPrefix):]
s.devices += dev
return nil
} | [
"func",
"(",
"s",
"*",
"SingleLetter",
")",
"Release",
"(",
"dev",
"string",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"dev",
",",
"s",
".",
"d... | // Release device letter to devices pool. | [
"Release",
"device",
"letter",
"to",
"devices",
"pool",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/pkg/device/device.go#L61-L70 |
143,967 | libopenstorage/openstorage | cluster/manager/manager.go | Init | func Init(cfg config.ClusterConfig) error {
if inst != nil {
return errClusterInitialized
}
kv := kvdb.Instance()
if kv == nil {
return errors.New("KVDB is not yet initialized. " +
"A valid KVDB instance required for the cluster to start.")
}
inst = &ClusterManager{
listeners: list.New(),
c... | go | func Init(cfg config.ClusterConfig) error {
if inst != nil {
return errClusterInitialized
}
kv := kvdb.Instance()
if kv == nil {
return errors.New("KVDB is not yet initialized. " +
"A valid KVDB instance required for the cluster to start.")
}
inst = &ClusterManager{
listeners: list.New(),
c... | [
"func",
"Init",
"(",
"cfg",
"config",
".",
"ClusterConfig",
")",
"error",
"{",
"if",
"inst",
"!=",
"nil",
"{",
"return",
"errClusterInitialized",
"\n",
"}",
"\n\n",
"kv",
":=",
"kvdb",
".",
"Instance",
"(",
")",
"\n",
"if",
"kv",
"==",
"nil",
"{",
"r... | // Init instantiates a new cluster manager. | [
"Init",
"instantiates",
"a",
"new",
"cluster",
"manager",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L105-L126 |
143,968 | libopenstorage/openstorage | cluster/manager/manager.go | ExternalIp | func ExternalIp(config *config.ClusterConfig) (string, string, error) {
mgmtIp := ""
dataIp := ""
var err error
if config.MgmtIp == "" && config.MgtIface != "" {
mgmtIp, err = ifaceNameToIp(config.MgtIface)
if err != nil {
return "", "", errors.New("Invalid data network interface " +
"specified.")
}
... | go | func ExternalIp(config *config.ClusterConfig) (string, string, error) {
mgmtIp := ""
dataIp := ""
var err error
if config.MgmtIp == "" && config.MgtIface != "" {
mgmtIp, err = ifaceNameToIp(config.MgtIface)
if err != nil {
return "", "", errors.New("Invalid data network interface " +
"specified.")
}
... | [
"func",
"ExternalIp",
"(",
"config",
"*",
"config",
".",
"ClusterConfig",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"mgmtIp",
":=",
"\"",
"\"",
"\n",
"dataIp",
":=",
"\"",
"\"",
"\n\n",
"var",
"err",
"error",
"\n",
"if",
"config",
".... | // ExternalIp returns the mgmt and data ip based on the config | [
"ExternalIp",
"returns",
"the",
"mgmt",
"and",
"data",
"ip",
"based",
"on",
"the",
"config"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L196-L252 |
143,969 | libopenstorage/openstorage | cluster/manager/manager.go | Inspect | func (c *ClusterManager) Inspect(nodeID string) (api.Node, error) {
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
return c.getNodeEntry(nodeID, &cluster.ClusterInfo{})
} | go | func (c *ClusterManager) Inspect(nodeID string) (api.Node, error) {
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
return c.getNodeEntry(nodeID, &cluster.ClusterInfo{})
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"Inspect",
"(",
"nodeID",
"string",
")",
"(",
"api",
".",
"Node",
",",
"error",
")",
"{",
"c",
".",
"nodeCacheLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"nodeCacheLock",
".",
"Unlock",
"(",
... | // Inspect inspects given node and returns the state | [
"Inspect",
"inspects",
"given",
"node",
"and",
"returns",
"the",
"state"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L293-L297 |
143,970 | libopenstorage/openstorage | cluster/manager/manager.go | AddEventListener | func (c *ClusterManager) AddEventListener(listener cluster.ClusterListener) error {
logrus.Printf("Adding cluster event listener: %s", listener.String())
c.listeners.PushBack(listener)
return nil
} | go | func (c *ClusterManager) AddEventListener(listener cluster.ClusterListener) error {
logrus.Printf("Adding cluster event listener: %s", listener.String())
c.listeners.PushBack(listener)
return nil
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"AddEventListener",
"(",
"listener",
"cluster",
".",
"ClusterListener",
")",
"error",
"{",
"logrus",
".",
"Printf",
"(",
"\"",
"\"",
",",
"listener",
".",
"String",
"(",
")",
")",
"\n",
"c",
".",
"listeners",... | // AddEventListener adds a new listener | [
"AddEventListener",
"adds",
"a",
"new",
"listener"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L300-L304 |
143,971 | libopenstorage/openstorage | cluster/manager/manager.go | UpdateData | func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error {
c.selfNodeLock.Lock()
defer c.selfNodeLock.Unlock()
for dataKey, dataValue := range nodeData {
c.selfNode.NodeData[dataKey] = dataValue
}
return nil
} | go | func (c *ClusterManager) UpdateData(nodeData map[string]interface{}) error {
c.selfNodeLock.Lock()
defer c.selfNodeLock.Unlock()
for dataKey, dataValue := range nodeData {
c.selfNode.NodeData[dataKey] = dataValue
}
return nil
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"UpdateData",
"(",
"nodeData",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"c",
".",
"selfNodeLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"selfNodeLock",
".",
"Unlock",
... | // UpdateData updates self node data | [
"UpdateData",
"updates",
"self",
"node",
"data"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L307-L314 |
143,972 | libopenstorage/openstorage | cluster/manager/manager.go | GetData | func (c *ClusterManager) GetData() (map[string]*api.Node, error) {
nodes := make(map[string]*api.Node)
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
for _, value := range c.nodeCache {
copyValue := value.Copy()
nodes[value.Id] = copyValue
}
return nodes, nil
} | go | func (c *ClusterManager) GetData() (map[string]*api.Node, error) {
nodes := make(map[string]*api.Node)
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
for _, value := range c.nodeCache {
copyValue := value.Copy()
nodes[value.Id] = copyValue
}
return nodes, nil
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"GetData",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"api",
".",
"Node",
",",
"error",
")",
"{",
"nodes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"api",
".",
"Node",
")",
"\n",
"c",
... | // GetData returns self node's data | [
"GetData",
"returns",
"self",
"node",
"s",
"data"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L347-L356 |
143,973 | libopenstorage/openstorage | cluster/manager/manager.go | GetNodeIdFromIp | func (c *ClusterManager) GetNodeIdFromIp(idIp string) (string, error) {
addr := net.ParseIP(idIp)
if addr != nil { // Is an IP, lookup Id
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
return c.nodeIdFromIp(idIp)
}
return idIp, nil // return input, assume its an Id
} | go | func (c *ClusterManager) GetNodeIdFromIp(idIp string) (string, error) {
addr := net.ParseIP(idIp)
if addr != nil { // Is an IP, lookup Id
c.nodeCacheLock.Lock()
defer c.nodeCacheLock.Unlock()
return c.nodeIdFromIp(idIp)
}
return idIp, nil // return input, assume its an Id
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"GetNodeIdFromIp",
"(",
"idIp",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"addr",
":=",
"net",
".",
"ParseIP",
"(",
"idIp",
")",
"\n",
"if",
"addr",
"!=",
"nil",
"{",
"// Is an IP, lookup Id",
"... | // GetNodeIdFromIp returns a Node Id given an IP. | [
"GetNodeIdFromIp",
"returns",
"a",
"Node",
"Id",
"given",
"an",
"IP",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L370-L379 |
143,974 | libopenstorage/openstorage | cluster/manager/manager.go | getCurrentState | func (c *ClusterManager) getCurrentState() *api.Node {
c.selfNodeLock.Lock()
defer c.selfNodeLock.Unlock()
c.selfNode.Timestamp = time.Now()
c.selfNode.Cpu, _, _ = c.system.CpuUsage()
c.selfNode.MemTotal, c.selfNode.MemUsed, c.selfNode.MemFree = c.system.MemUsage()
c.selfNode.Timestamp = time.Now()
for e := c... | go | func (c *ClusterManager) getCurrentState() *api.Node {
c.selfNodeLock.Lock()
defer c.selfNodeLock.Unlock()
c.selfNode.Timestamp = time.Now()
c.selfNode.Cpu, _, _ = c.system.CpuUsage()
c.selfNode.MemTotal, c.selfNode.MemUsed, c.selfNode.MemFree = c.system.MemUsage()
c.selfNode.Timestamp = time.Now()
for e := c... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"getCurrentState",
"(",
")",
"*",
"api",
".",
"Node",
"{",
"c",
".",
"selfNodeLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"selfNodeLock",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"selfNode",
... | // getCurrentState always returns the copy of selfNode that
// cluster manager maintains. It also updates the selfNode
// with latest data. | [
"getCurrentState",
"always",
"returns",
"the",
"copy",
"of",
"selfNode",
"that",
"cluster",
"manager",
"maintains",
".",
"It",
"also",
"updates",
"the",
"selfNode",
"with",
"latest",
"data",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L384-L406 |
143,975 | libopenstorage/openstorage | cluster/manager/manager.go | watchDB | func (c *ClusterManager) watchDB(key string, opaque interface{},
kvp *kvdb.KVPair, watchErr error) error {
db, kvdbVersion, err := readClusterInfo()
if err != nil {
logrus.Warnln("Failed to read database after update ", err)
// Exit since an update may be missed here.
os.Exit(1)
}
// Update all the listen... | go | func (c *ClusterManager) watchDB(key string, opaque interface{},
kvp *kvdb.KVPair, watchErr error) error {
db, kvdbVersion, err := readClusterInfo()
if err != nil {
logrus.Warnln("Failed to read database after update ", err)
// Exit since an update may be missed here.
os.Exit(1)
}
// Update all the listen... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"watchDB",
"(",
"key",
"string",
",",
"opaque",
"interface",
"{",
"}",
",",
"kvp",
"*",
"kvdb",
".",
"KVPair",
",",
"watchErr",
"error",
")",
"error",
"{",
"db",
",",
"kvdbVersion",
",",
"err",
":=",
"rea... | // Get the latest config. | [
"Get",
"the",
"latest",
"config",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L426-L504 |
143,976 | libopenstorage/openstorage | cluster/manager/manager.go | initNodeInCluster | func (c *ClusterManager) initNodeInCluster(
clusterInfo *cluster.ClusterInfo,
self *api.Node,
exist bool,
nodeInitialized bool,
) ([]cluster.FinalizeInitCb, error) {
// If I am already in the cluster map, don't add me again.
if exist {
return nil, nil
}
if nodeInitialized {
logrus.Errorf(cluster.ErrInitNod... | go | func (c *ClusterManager) initNodeInCluster(
clusterInfo *cluster.ClusterInfo,
self *api.Node,
exist bool,
nodeInitialized bool,
) ([]cluster.FinalizeInitCb, error) {
// If I am already in the cluster map, don't add me again.
if exist {
return nil, nil
}
if nodeInitialized {
logrus.Errorf(cluster.ErrInitNod... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"initNodeInCluster",
"(",
"clusterInfo",
"*",
"cluster",
".",
"ClusterInfo",
",",
"self",
"*",
"api",
".",
"Node",
",",
"exist",
"bool",
",",
"nodeInitialized",
"bool",
",",
")",
"(",
"[",
"]",
"cluster",
"."... | // Initialize node and alert listeners that we are initializing a node in the cluster. | [
"Initialize",
"node",
"and",
"alert",
"listeners",
"that",
"we",
"are",
"initializing",
"a",
"node",
"in",
"the",
"cluster",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L578-L613 |
143,977 | libopenstorage/openstorage | cluster/manager/manager.go | joinCluster | func (c *ClusterManager) joinCluster(
self *api.Node,
exist bool,
) error {
// Listeners may update initial state, so snap again.
// The cluster db may have diverged since we waited for quorum
// in between. Snapshot is created under cluster db lock to make
// sure cluster db updates do not happen during snapshot... | go | func (c *ClusterManager) joinCluster(
self *api.Node,
exist bool,
) error {
// Listeners may update initial state, so snap again.
// The cluster db may have diverged since we waited for quorum
// in between. Snapshot is created under cluster db lock to make
// sure cluster db updates do not happen during snapshot... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"joinCluster",
"(",
"self",
"*",
"api",
".",
"Node",
",",
"exist",
"bool",
",",
")",
"error",
"{",
"// Listeners may update initial state, so snap again.",
"// The cluster db may have diverged since we waited for quorum",
"// ... | // Alert all listeners that we are joining the cluster | [
"Alert",
"all",
"listeners",
"that",
"we",
"are",
"joining",
"the",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L616-L673 |
143,978 | libopenstorage/openstorage | cluster/manager/manager.go | DisableUpdates | func (c *ClusterManager) DisableUpdates() error {
logrus.Warnln("Disabling gossip updates")
c.gEnabled = false
return nil
} | go | func (c *ClusterManager) DisableUpdates() error {
logrus.Warnln("Disabling gossip updates")
c.gEnabled = false
return nil
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"DisableUpdates",
"(",
")",
"error",
"{",
"logrus",
".",
"Warnln",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"gEnabled",
"=",
"false",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // DisableUpdates disables gossip updates | [
"DisableUpdates",
"disables",
"gossip",
"updates"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L943-L948 |
143,979 | libopenstorage/openstorage | cluster/manager/manager.go | EnableUpdates | func (c *ClusterManager) EnableUpdates() error {
logrus.Warnln("Enabling gossip updates")
c.gEnabled = true
return nil
} | go | func (c *ClusterManager) EnableUpdates() error {
logrus.Warnln("Enabling gossip updates")
c.gEnabled = true
return nil
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"EnableUpdates",
"(",
")",
"error",
"{",
"logrus",
".",
"Warnln",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"gEnabled",
"=",
"true",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // EnableUpdates enables gossip updates | [
"EnableUpdates",
"enables",
"gossip",
"updates"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L951-L956 |
143,980 | libopenstorage/openstorage | cluster/manager/manager.go | GetGossipState | func (c *ClusterManager) GetGossipState() *cluster.ClusterState {
gossipStoreKey := types.StoreKey(heartbeatKey + c.config.ClusterId)
nodeValue := c.gossip.GetStoreKeyValue(gossipStoreKey)
nodes := make([]types.NodeValue, len(nodeValue), len(nodeValue))
i := 0
for _, value := range nodeValue {
nodes[i] = value
... | go | func (c *ClusterManager) GetGossipState() *cluster.ClusterState {
gossipStoreKey := types.StoreKey(heartbeatKey + c.config.ClusterId)
nodeValue := c.gossip.GetStoreKeyValue(gossipStoreKey)
nodes := make([]types.NodeValue, len(nodeValue), len(nodeValue))
i := 0
for _, value := range nodeValue {
nodes[i] = value
... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"GetGossipState",
"(",
")",
"*",
"cluster",
".",
"ClusterState",
"{",
"gossipStoreKey",
":=",
"types",
".",
"StoreKey",
"(",
"heartbeatKey",
"+",
"c",
".",
"config",
".",
"ClusterId",
")",
"\n",
"nodeValue",
":... | // GetGossipState returns current gossip state | [
"GetGossipState",
"returns",
"current",
"gossip",
"state"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L959-L970 |
143,981 | libopenstorage/openstorage | cluster/manager/manager.go | Start | func (c *ClusterManager) Start(
clusterMaxSize int,
nodeInitialized bool,
gossipPort string,
selfClusterDomain string,
) error {
return c.StartWithConfiguration(
clusterMaxSize,
nodeInitialized,
gossipPort,
[]string{ClusterDBKey},
selfClusterDomain,
&cluster.ClusterServerConfiguration{})
} | go | func (c *ClusterManager) Start(
clusterMaxSize int,
nodeInitialized bool,
gossipPort string,
selfClusterDomain string,
) error {
return c.StartWithConfiguration(
clusterMaxSize,
nodeInitialized,
gossipPort,
[]string{ClusterDBKey},
selfClusterDomain,
&cluster.ClusterServerConfiguration{})
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"Start",
"(",
"clusterMaxSize",
"int",
",",
"nodeInitialized",
"bool",
",",
"gossipPort",
"string",
",",
"selfClusterDomain",
"string",
",",
")",
"error",
"{",
"return",
"c",
".",
"StartWithConfiguration",
"(",
"cl... | // Start initiates the cluster manager and the cluster state machine | [
"Start",
"initiates",
"the",
"cluster",
"manager",
"and",
"the",
"cluster",
"state",
"machine"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1254-L1267 |
143,982 | libopenstorage/openstorage | cluster/manager/manager.go | NodeStatus | func (c *ClusterManager) NodeStatus() (api.Status, error) {
clusterNodeStatus := c.selfNode.Status
if clusterNodeStatus != api.Status_STATUS_OK {
// Status of this node as seen by Cluster Manager is not OK
// This takes highest precedence over other listener statuses.
// Returning our status
return clusterNo... | go | func (c *ClusterManager) NodeStatus() (api.Status, error) {
clusterNodeStatus := c.selfNode.Status
if clusterNodeStatus != api.Status_STATUS_OK {
// Status of this node as seen by Cluster Manager is not OK
// This takes highest precedence over other listener statuses.
// Returning our status
return clusterNo... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"NodeStatus",
"(",
")",
"(",
"api",
".",
"Status",
",",
"error",
")",
"{",
"clusterNodeStatus",
":=",
"c",
".",
"selfNode",
".",
"Status",
"\n\n",
"if",
"clusterNodeStatus",
"!=",
"api",
".",
"Status_STATUS_OK"... | // NodeStatus returns the status of a node. It compares the status maintained by the
// cluster manager and the provided listener and returns the appropriate one | [
"NodeStatus",
"returns",
"the",
"status",
"of",
"a",
"node",
".",
"It",
"compares",
"the",
"status",
"maintained",
"by",
"the",
"cluster",
"manager",
"and",
"the",
"provided",
"listener",
"and",
"returns",
"the",
"appropriate",
"one"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1373-L1394 |
143,983 | libopenstorage/openstorage | cluster/manager/manager.go | PeerStatus | func (c *ClusterManager) PeerStatus(listenerName string) (map[string]api.Status, error) {
statusMap := make(map[string]api.Status)
var listenerStatusMap map[string]api.Status
for e := c.listeners.Front(); e != nil; e = e.Next() {
if e.Value.(cluster.ClusterListener).String() == listenerName {
listenerStatusMap ... | go | func (c *ClusterManager) PeerStatus(listenerName string) (map[string]api.Status, error) {
statusMap := make(map[string]api.Status)
var listenerStatusMap map[string]api.Status
for e := c.listeners.Front(); e != nil; e = e.Next() {
if e.Value.(cluster.ClusterListener).String() == listenerName {
listenerStatusMap ... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"PeerStatus",
"(",
"listenerName",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"api",
".",
"Status",
",",
"error",
")",
"{",
"statusMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"api",
".",
"Stat... | // PeerStatus returns the status of a peer node as seen by us | [
"PeerStatus",
"returns",
"the",
"status",
"of",
"a",
"peer",
"node",
"as",
"seen",
"by",
"us"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1397-L1441 |
143,984 | libopenstorage/openstorage | cluster/manager/manager.go | Enumerate | func (c *ClusterManager) Enumerate() (api.Cluster, error) {
clusterState := api.Cluster{
Id: c.config.ClusterId,
Status: c.status,
NodeId: c.selfNode.Id,
}
if c.selfNode.Status == api.Status_STATUS_NOT_IN_QUORUM ||
c.selfNode.Status == api.Status_STATUS_MAINTENANCE {
// If the node is not yet ready, q... | go | func (c *ClusterManager) Enumerate() (api.Cluster, error) {
clusterState := api.Cluster{
Id: c.config.ClusterId,
Status: c.status,
NodeId: c.selfNode.Id,
}
if c.selfNode.Status == api.Status_STATUS_NOT_IN_QUORUM ||
c.selfNode.Status == api.Status_STATUS_MAINTENANCE {
// If the node is not yet ready, q... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"Enumerate",
"(",
")",
"(",
"api",
".",
"Cluster",
",",
"error",
")",
"{",
"clusterState",
":=",
"api",
".",
"Cluster",
"{",
"Id",
":",
"c",
".",
"config",
".",
"ClusterId",
",",
"Status",
":",
"c",
"."... | // Enumerate lists all the nodes in the cluster. | [
"Enumerate",
"lists",
"all",
"the",
"nodes",
"in",
"the",
"cluster",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1487-L1512 |
143,985 | libopenstorage/openstorage | cluster/manager/manager.go | SetSize | func (c *ClusterManager) SetSize(size int) error {
kvdb := kvdb.Instance()
kvlock, err := kvdb.LockWithID(clusterLockKey, c.config.NodeId)
if err != nil {
logrus.Warnln("Unable to obtain cluster lock for updating config", err)
return nil
}
defer kvdb.Unlock(kvlock)
db, _, err := readClusterInfo()
if err != ... | go | func (c *ClusterManager) SetSize(size int) error {
kvdb := kvdb.Instance()
kvlock, err := kvdb.LockWithID(clusterLockKey, c.config.NodeId)
if err != nil {
logrus.Warnln("Unable to obtain cluster lock for updating config", err)
return nil
}
defer kvdb.Unlock(kvlock)
db, _, err := readClusterInfo()
if err != ... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"SetSize",
"(",
"size",
"int",
")",
"error",
"{",
"kvdb",
":=",
"kvdb",
".",
"Instance",
"(",
")",
"\n",
"kvlock",
",",
"err",
":=",
"kvdb",
".",
"LockWithID",
"(",
"clusterLockKey",
",",
"c",
".",
"confi... | // SetSize sets the maximum number of nodes in a cluster. | [
"SetSize",
"sets",
"the",
"maximum",
"number",
"of",
"nodes",
"in",
"a",
"cluster",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1549-L1568 |
143,986 | libopenstorage/openstorage | cluster/manager/manager.go | NodeRemoveDone | func (c *ClusterManager) NodeRemoveDone(nodeID string, result error) {
// XXX: only storage will make callback right now
if result != nil {
msg := fmt.Sprintf("Storage failed to decommission node %s, "+
"error %s",
nodeID,
result)
logrus.Errorf(msg)
return
}
logrus.Infof("Cluster manager node remove... | go | func (c *ClusterManager) NodeRemoveDone(nodeID string, result error) {
// XXX: only storage will make callback right now
if result != nil {
msg := fmt.Sprintf("Storage failed to decommission node %s, "+
"error %s",
nodeID,
result)
logrus.Errorf(msg)
return
}
logrus.Infof("Cluster manager node remove... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"NodeRemoveDone",
"(",
"nodeID",
"string",
",",
"result",
"error",
")",
"{",
"// XXX: only storage will make callback right now",
"if",
"result",
"!=",
"nil",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"... | // NodeRemoveDone is called from the listeners when their job of Node removal is done. | [
"NodeRemoveDone",
"is",
"called",
"from",
"the",
"listeners",
"when",
"their",
"job",
"of",
"Node",
"removal",
"is",
"done",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1771-L1795 |
143,987 | libopenstorage/openstorage | cluster/manager/manager.go | Shutdown | func (c *ClusterManager) Shutdown() error {
db, _, err := readClusterInfo()
if err != nil {
logrus.Warnf("Could not read cluster database (%v).", err)
return err
}
// Alert all listeners that we are shutting this node down.
for e := c.listeners.Front(); e != nil; e = e.Next() {
logrus.Infof("Shutting down %... | go | func (c *ClusterManager) Shutdown() error {
db, _, err := readClusterInfo()
if err != nil {
logrus.Warnf("Could not read cluster database (%v).", err)
return err
}
// Alert all listeners that we are shutting this node down.
for e := c.listeners.Front(); e != nil; e = e.Next() {
logrus.Infof("Shutting down %... | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"Shutdown",
"(",
")",
"error",
"{",
"db",
",",
"_",
",",
"err",
":=",
"readClusterInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
... | // Shutdown can be called when THIS node is gracefully shutting down. | [
"Shutdown",
"can",
"be",
"called",
"when",
"THIS",
"node",
"is",
"gracefully",
"shutting",
"down",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1823-L1839 |
143,988 | libopenstorage/openstorage | cluster/manager/manager.go | InspectDomain | func (c *ClusterManager) InspectDomain(name string) (*clusterdomain.ClusterDomainInfo, error) {
return c.clusterDomainManager.InspectDomain(name)
} | go | func (c *ClusterManager) InspectDomain(name string) (*clusterdomain.ClusterDomainInfo, error) {
return c.clusterDomainManager.InspectDomain(name)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"InspectDomain",
"(",
"name",
"string",
")",
"(",
"*",
"clusterdomain",
".",
"ClusterDomainInfo",
",",
"error",
")",
"{",
"return",
"c",
".",
"clusterDomainManager",
".",
"InspectDomain",
"(",
"name",
")",
"\n",
... | // InspectDomain returns the cluster domain info for the provided argument. | [
"InspectDomain",
"returns",
"the",
"cluster",
"domain",
"info",
"for",
"the",
"provided",
"argument",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1906-L1908 |
143,989 | libopenstorage/openstorage | cluster/manager/manager.go | DeleteDomain | func (c *ClusterManager) DeleteDomain(name string) error {
return c.clusterDomainManager.DeleteDomain(name)
} | go | func (c *ClusterManager) DeleteDomain(name string) error {
return c.clusterDomainManager.DeleteDomain(name)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"DeleteDomain",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"clusterDomainManager",
".",
"DeleteDomain",
"(",
"name",
")",
"\n",
"}"
] | // DeleteDomain deletes a cluster domain entry | [
"DeleteDomain",
"deletes",
"a",
"cluster",
"domain",
"entry"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1911-L1913 |
143,990 | libopenstorage/openstorage | cluster/manager/manager.go | SchedPolicyCreate | func (c *ClusterManager) SchedPolicyCreate(name, sched string) error {
return c.schedManager.SchedPolicyCreate(name, sched)
} | go | func (c *ClusterManager) SchedPolicyCreate(name, sched string) error {
return c.schedManager.SchedPolicyCreate(name, sched)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"SchedPolicyCreate",
"(",
"name",
",",
"sched",
"string",
")",
"error",
"{",
"return",
"c",
".",
"schedManager",
".",
"SchedPolicyCreate",
"(",
"name",
",",
"sched",
")",
"\n",
"}"
] | // SchedPolicyCreate creates a policy with given name and schedule. | [
"SchedPolicyCreate",
"creates",
"a",
"policy",
"with",
"given",
"name",
"and",
"schedule",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1946-L1948 |
143,991 | libopenstorage/openstorage | cluster/manager/manager.go | SchedPolicyUpdate | func (c *ClusterManager) SchedPolicyUpdate(name, sched string) error {
return c.schedManager.SchedPolicyUpdate(name, sched)
} | go | func (c *ClusterManager) SchedPolicyUpdate(name, sched string) error {
return c.schedManager.SchedPolicyUpdate(name, sched)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"SchedPolicyUpdate",
"(",
"name",
",",
"sched",
"string",
")",
"error",
"{",
"return",
"c",
".",
"schedManager",
".",
"SchedPolicyUpdate",
"(",
"name",
",",
"sched",
")",
"\n",
"}"
] | // SchedPolicyUpdate updates a policy with given name and schedule. | [
"SchedPolicyUpdate",
"updates",
"a",
"policy",
"with",
"given",
"name",
"and",
"schedule",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1951-L1953 |
143,992 | libopenstorage/openstorage | cluster/manager/manager.go | SchedPolicyDelete | func (c *ClusterManager) SchedPolicyDelete(name string) error {
return c.schedManager.SchedPolicyDelete(name)
} | go | func (c *ClusterManager) SchedPolicyDelete(name string) error {
return c.schedManager.SchedPolicyDelete(name)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"SchedPolicyDelete",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"schedManager",
".",
"SchedPolicyDelete",
"(",
"name",
")",
"\n",
"}"
] | // SchedPolicyDelete deletes a policy with given name. | [
"SchedPolicyDelete",
"deletes",
"a",
"policy",
"with",
"given",
"name",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1956-L1958 |
143,993 | libopenstorage/openstorage | cluster/manager/manager.go | ObjectStoreInspect | func (c *ClusterManager) ObjectStoreInspect(objectstoreID string) (*api.ObjectstoreInfo, error) {
return c.objstoreManager.ObjectStoreInspect(objectstoreID)
} | go | func (c *ClusterManager) ObjectStoreInspect(objectstoreID string) (*api.ObjectstoreInfo, error) {
return c.objstoreManager.ObjectStoreInspect(objectstoreID)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"ObjectStoreInspect",
"(",
"objectstoreID",
"string",
")",
"(",
"*",
"api",
".",
"ObjectstoreInfo",
",",
"error",
")",
"{",
"return",
"c",
".",
"objstoreManager",
".",
"ObjectStoreInspect",
"(",
"objectstoreID",
")... | // ObjectStoreInspect returns status of objectstore | [
"ObjectStoreInspect",
"returns",
"status",
"of",
"objectstore"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1971-L1973 |
143,994 | libopenstorage/openstorage | cluster/manager/manager.go | ObjectStoreCreate | func (c *ClusterManager) ObjectStoreCreate(volumeID string) (*api.ObjectstoreInfo, error) {
return c.objstoreManager.ObjectStoreCreate(volumeID)
} | go | func (c *ClusterManager) ObjectStoreCreate(volumeID string) (*api.ObjectstoreInfo, error) {
return c.objstoreManager.ObjectStoreCreate(volumeID)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"ObjectStoreCreate",
"(",
"volumeID",
"string",
")",
"(",
"*",
"api",
".",
"ObjectstoreInfo",
",",
"error",
")",
"{",
"return",
"c",
".",
"objstoreManager",
".",
"ObjectStoreCreate",
"(",
"volumeID",
")",
"\n",
... | // ObjectStoreCreate objectstore on specified volume | [
"ObjectStoreCreate",
"objectstore",
"on",
"specified",
"volume"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1976-L1978 |
143,995 | libopenstorage/openstorage | cluster/manager/manager.go | ObjectStoreDelete | func (c *ClusterManager) ObjectStoreDelete(objectstoreID string) error {
return c.objstoreManager.ObjectStoreDelete(objectstoreID)
} | go | func (c *ClusterManager) ObjectStoreDelete(objectstoreID string) error {
return c.objstoreManager.ObjectStoreDelete(objectstoreID)
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"ObjectStoreDelete",
"(",
"objectstoreID",
"string",
")",
"error",
"{",
"return",
"c",
".",
"objstoreManager",
".",
"ObjectStoreDelete",
"(",
"objectstoreID",
")",
"\n",
"}"
] | // ObjectStoreDelete objectstore from cluster | [
"ObjectStoreDelete",
"objectstore",
"from",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L1986-L1988 |
143,996 | libopenstorage/openstorage | cluster/manager/manager.go | Uuid | func (c *ClusterManager) Uuid() string {
if len(c.config.ClusterUuid) == 0 {
return c.config.ClusterId
}
return c.config.ClusterUuid
} | go | func (c *ClusterManager) Uuid() string {
if len(c.config.ClusterUuid) == 0 {
return c.config.ClusterId
}
return c.config.ClusterUuid
} | [
"func",
"(",
"c",
"*",
"ClusterManager",
")",
"Uuid",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"c",
".",
"config",
".",
"ClusterUuid",
")",
"==",
"0",
"{",
"return",
"c",
".",
"config",
".",
"ClusterId",
"\n",
"}",
"\n",
"return",
"c",
".",
"co... | // Uuid returns the unique id of the cluster | [
"Uuid",
"returns",
"the",
"unique",
"id",
"of",
"the",
"cluster"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/cluster/manager/manager.go#L2021-L2026 |
143,997 | libopenstorage/openstorage | api/server/sdk/alerts.go | NewAlertsServer | func NewAlertsServer(filterDeleter alerts.FilterDeleter) api.OpenStorageAlertsServer {
return &alertsServer{
server: &sdkGrpcServer{alertHandler: filterDeleter},
}
} | go | func NewAlertsServer(filterDeleter alerts.FilterDeleter) api.OpenStorageAlertsServer {
return &alertsServer{
server: &sdkGrpcServer{alertHandler: filterDeleter},
}
} | [
"func",
"NewAlertsServer",
"(",
"filterDeleter",
"alerts",
".",
"FilterDeleter",
")",
"api",
".",
"OpenStorageAlertsServer",
"{",
"return",
"&",
"alertsServer",
"{",
"server",
":",
"&",
"sdkGrpcServer",
"{",
"alertHandler",
":",
"filterDeleter",
"}",
",",
"}",
"... | // NewAlertsServer provides an instance of alerts server interface. | [
"NewAlertsServer",
"provides",
"an",
"instance",
"of",
"alerts",
"server",
"interface",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/alerts.go#L49-L53 |
143,998 | libopenstorage/openstorage | api/server/sdk/alerts.go | EnumerateWithFilters | func (g *alertsServer) EnumerateWithFilters(request *api.SdkAlertsEnumerateWithFiltersRequest, stream api.OpenStorageAlerts_EnumerateWithFiltersServer) error {
ctx := stream.Context()
if g.alert() == nil {
return status.Error(codes.Unavailable, "Resource has not been initialized")
}
queries := request.GetQuerie... | go | func (g *alertsServer) EnumerateWithFilters(request *api.SdkAlertsEnumerateWithFiltersRequest, stream api.OpenStorageAlerts_EnumerateWithFiltersServer) error {
ctx := stream.Context()
if g.alert() == nil {
return status.Error(codes.Unavailable, "Resource has not been initialized")
}
queries := request.GetQuerie... | [
"func",
"(",
"g",
"*",
"alertsServer",
")",
"EnumerateWithFilters",
"(",
"request",
"*",
"api",
".",
"SdkAlertsEnumerateWithFiltersRequest",
",",
"stream",
"api",
".",
"OpenStorageAlerts_EnumerateWithFiltersServer",
")",
"error",
"{",
"ctx",
":=",
"stream",
".",
"Co... | // EnumerateWithFilters implements api.OpenStorageAlertsServer for alertsServer.
// Input context should ideally have a deadline, in which case, a
// graceful exit is ensured within that deadline. | [
"EnumerateWithFilters",
"implements",
"api",
".",
"OpenStorageAlertsServer",
"for",
"alertsServer",
".",
"Input",
"context",
"should",
"ideally",
"have",
"a",
"deadline",
"in",
"which",
"case",
"a",
"graceful",
"exit",
"is",
"ensured",
"within",
"that",
"deadline",
... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/alerts.go#L118-L192 |
143,999 | libopenstorage/openstorage | api/server/sdk/alerts.go | Delete | func (g *alertsServer) Delete(ctx context.Context,
request *api.SdkAlertsDeleteRequest) (*api.SdkAlertsDeleteResponse, error) {
if g.alert() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
queries := request.GetQueries()
if queries == nil {
return nil, status.Error(... | go | func (g *alertsServer) Delete(ctx context.Context,
request *api.SdkAlertsDeleteRequest) (*api.SdkAlertsDeleteResponse, error) {
if g.alert() == nil {
return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
}
queries := request.GetQueries()
if queries == nil {
return nil, status.Error(... | [
"func",
"(",
"g",
"*",
"alertsServer",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"api",
".",
"SdkAlertsDeleteRequest",
")",
"(",
"*",
"api",
".",
"SdkAlertsDeleteResponse",
",",
"error",
")",
"{",
"if",
"g",
".",
"alert",... | // Delete implements api.OpenStorageAlertsServer for alertsServer.
// Input context should ideally have a deadline, in which case, a
// graceful exit is ensured within that deadline. | [
"Delete",
"implements",
"api",
".",
"OpenStorageAlertsServer",
"for",
"alertsServer",
".",
"Input",
"context",
"should",
"ideally",
"have",
"a",
"deadline",
"in",
"which",
"case",
"a",
"graceful",
"exit",
"is",
"ensured",
"within",
"that",
"deadline",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/api/server/sdk/alerts.go#L197-L246 |
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.