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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,900 | 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 |
21,901 | 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 |
21,902 | 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 |
21,903 | 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 |
21,904 | 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 |
21,905 | 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 |
21,906 | 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 |
21,907 | 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 |
21,908 | 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 |
21,909 | 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 |
21,910 | 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 |
21,911 | 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 |
21,912 | 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 |
21,913 | 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 |
21,914 | 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 |
21,915 | 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 |
21,916 | 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 |
21,917 | 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 |
21,918 | 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 |
21,919 | 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 |
21,920 | 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 |
21,921 | 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 |
21,922 | 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 |
21,923 | 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 |
21,924 | 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 |
21,925 | 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 |
21,926 | 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 |
21,927 | 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 |
21,928 | 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 |
21,929 | 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 |
21,930 | 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 |
21,931 | 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 |
21,932 | 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 |
21,933 | 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 |
21,934 | 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 |
21,935 | 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 |
21,936 | 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 |
21,937 | 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 |
21,938 | 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 |
21,939 | 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 |
21,940 | 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 |
21,941 | 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 |
21,942 | 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 |
21,943 | 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 |
21,944 | 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 |
21,945 | 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 |
21,946 | 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 |
21,947 | 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 |
21,948 | 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 |
21,949 | 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 |
21,950 | 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 |
21,951 | 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 |
21,952 | 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 |
21,953 | 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 |
21,954 | 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 |
21,955 | 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 |
21,956 | 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 |
21,957 | 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 |
21,958 | 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 |
21,959 | 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 |
21,960 | 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 |
21,961 | 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 |
21,962 | 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 |
21,963 | 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 |
21,964 | 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 |
21,965 | 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 |
21,966 | 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 |
21,967 | 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 |
21,968 | 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 |
21,969 | 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 |
21,970 | 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 |
21,971 | 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 |
21,972 | 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 |
21,973 | 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 |
21,974 | 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 |
21,975 | 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 |
21,976 | 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 |
21,977 | 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 |
21,978 | 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 |
21,979 | 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 |
21,980 | 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 |
21,981 | 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 |
21,982 | 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 |
21,983 | 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 |
21,984 | libopenstorage/openstorage | osdconfig/helper.go | newInMemKvdb | func newInMemKvdb() (kvdb.Kvdb, error) {
// create in memory kvdb
if kv, err := kvdb.New(mem.Name, "", []string{}, nil, nil); err != nil {
return nil, err
} else {
return kv, nil
}
} | go | func newInMemKvdb() (kvdb.Kvdb, error) {
// create in memory kvdb
if kv, err := kvdb.New(mem.Name, "", []string{}, nil, nil); err != nil {
return nil, err
} else {
return kv, nil
}
} | [
"func",
"newInMemKvdb",
"(",
")",
"(",
"kvdb",
".",
"Kvdb",
",",
"error",
")",
"{",
"// create in memory kvdb",
"if",
"kv",
",",
"err",
":=",
"kvdb",
".",
"New",
"(",
"mem",
".",
"Name",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"}",
",",
"n... | // helper function go get a new kvdb instance | [
"helper",
"function",
"go",
"get",
"a",
"new",
"kvdb",
"instance"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/osdconfig/helper.go#L12-L19 |
21,985 | libopenstorage/openstorage | osdconfig/helper.go | getNodeKeyFromNodeID | func getNodeKeyFromNodeID(nodeID string) string {
dbg.Assert(len(nodeID) > 0, "%s", "nodeID string can not be empty")
return filepath.Join(baseKey, nodeKey, nodeID)
} | go | func getNodeKeyFromNodeID(nodeID string) string {
dbg.Assert(len(nodeID) > 0, "%s", "nodeID string can not be empty")
return filepath.Join(baseKey, nodeKey, nodeID)
} | [
"func",
"getNodeKeyFromNodeID",
"(",
"nodeID",
"string",
")",
"string",
"{",
"dbg",
".",
"Assert",
"(",
"len",
"(",
"nodeID",
")",
">",
"0",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"baseKey",
",",
"nodeKey... | // helper function to obtain kvdb key for node based on nodeID
// the check for empty nodeID needs to be done elsewhere | [
"helper",
"function",
"to",
"obtain",
"kvdb",
"key",
"for",
"node",
"based",
"on",
"nodeID",
"the",
"check",
"for",
"empty",
"nodeID",
"needs",
"to",
"be",
"done",
"elsewhere"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/osdconfig/helper.go#L23-L26 |
21,986 | libopenstorage/openstorage | osdconfig/helper.go | copyData | func copyData(wd *data) *data {
wd2 := new(data)
wd2.Key = wd.Key
wd2.Value = make([]byte, len(wd.Value))
copy(wd2.Value, wd.Value)
return wd2
} | go | func copyData(wd *data) *data {
wd2 := new(data)
wd2.Key = wd.Key
wd2.Value = make([]byte, len(wd.Value))
copy(wd2.Value, wd.Value)
return wd2
} | [
"func",
"copyData",
"(",
"wd",
"*",
"data",
")",
"*",
"data",
"{",
"wd2",
":=",
"new",
"(",
"data",
")",
"\n",
"wd2",
".",
"Key",
"=",
"wd",
".",
"Key",
"\n",
"wd2",
".",
"Value",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"len",
"(",
"wd",
"... | // copyData is a helper function to copy data to be fed to each callback | [
"copyData",
"is",
"a",
"helper",
"function",
"to",
"copy",
"data",
"to",
"be",
"fed",
"to",
"each",
"callback"
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/osdconfig/helper.go#L29-L35 |
21,987 | libopenstorage/openstorage | alerts/api.go | NewManager | func NewManager(kv kvdb.Kvdb, options ...Option) (Manager, error) {
return newManager(kv, options...)
} | go | func NewManager(kv kvdb.Kvdb, options ...Option) (Manager, error) {
return newManager(kv, options...)
} | [
"func",
"NewManager",
"(",
"kv",
"kvdb",
".",
"Kvdb",
",",
"options",
"...",
"Option",
")",
"(",
"Manager",
",",
"error",
")",
"{",
"return",
"newManager",
"(",
"kv",
",",
"options",
"...",
")",
"\n",
"}"
] | // NewManager obtains instance of Manager for alerts management. | [
"NewManager",
"obtains",
"instance",
"of",
"Manager",
"for",
"alerts",
"management",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L11-L13 |
21,988 | libopenstorage/openstorage | alerts/api.go | NewFilterDeleter | func NewFilterDeleter(kv kvdb.Kvdb, options ...Option) (FilterDeleter, error) {
return newManager(kv, options...)
} | go | func NewFilterDeleter(kv kvdb.Kvdb, options ...Option) (FilterDeleter, error) {
return newManager(kv, options...)
} | [
"func",
"NewFilterDeleter",
"(",
"kv",
"kvdb",
".",
"Kvdb",
",",
"options",
"...",
"Option",
")",
"(",
"FilterDeleter",
",",
"error",
")",
"{",
"return",
"newManager",
"(",
"kv",
",",
"options",
"...",
")",
"\n",
"}"
] | // NewFilterDeleter obtains instance of FilterDeleter for alerts enumeration and deletion. | [
"NewFilterDeleter",
"obtains",
"instance",
"of",
"FilterDeleter",
"for",
"alerts",
"enumeration",
"and",
"deletion",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L16-L18 |
21,989 | libopenstorage/openstorage | alerts/api.go | NewTimeSpanOption | func NewTimeSpanOption(start, stop time.Time) Option {
return &option{optionType: timeSpanOption, value: NewTimeSpanFilter(start, stop)}
} | go | func NewTimeSpanOption(start, stop time.Time) Option {
return &option{optionType: timeSpanOption, value: NewTimeSpanFilter(start, stop)}
} | [
"func",
"NewTimeSpanOption",
"(",
"start",
",",
"stop",
"time",
".",
"Time",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"optionType",
":",
"timeSpanOption",
",",
"value",
":",
"NewTimeSpanFilter",
"(",
"start",
",",
"stop",
")",
"}",
"\n",
"}"
] | // NewTimeSpanOption provides an option to be used in filter definition.
// Filters that take options, apply options only during matching alerts. | [
"NewTimeSpanOption",
"provides",
"an",
"option",
"to",
"be",
"used",
"in",
"filter",
"definition",
".",
"Filters",
"that",
"take",
"options",
"apply",
"options",
"only",
"during",
"matching",
"alerts",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L29-L31 |
21,990 | libopenstorage/openstorage | alerts/api.go | NewCountSpanOption | func NewCountSpanOption(minCount, maxCount int64) Option {
return &option{optionType: countSpanOption, value: NewCountSpanFilter(minCount, maxCount)}
} | go | func NewCountSpanOption(minCount, maxCount int64) Option {
return &option{optionType: countSpanOption, value: NewCountSpanFilter(minCount, maxCount)}
} | [
"func",
"NewCountSpanOption",
"(",
"minCount",
",",
"maxCount",
"int64",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"optionType",
":",
"countSpanOption",
",",
"value",
":",
"NewCountSpanFilter",
"(",
"minCount",
",",
"maxCount",
")",
"}",
"\n",
"}"
] | // NewCountSpanOption provides an option to be used in filter definition that
// accept options. Only filters that are efficient in querying kvdb accept options
// and apply these options during matching alerts. | [
"NewCountSpanOption",
"provides",
"an",
"option",
"to",
"be",
"used",
"in",
"filter",
"definition",
"that",
"accept",
"options",
".",
"Only",
"filters",
"that",
"are",
"efficient",
"in",
"querying",
"kvdb",
"accept",
"options",
"and",
"apply",
"these",
"options"... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L36-L38 |
21,991 | libopenstorage/openstorage | alerts/api.go | NewMinSeverityOption | func NewMinSeverityOption(minSev api.SeverityType) Option {
return &option{optionType: minSeverityOption, value: NewMinSeverityFilter(minSev)}
} | go | func NewMinSeverityOption(minSev api.SeverityType) Option {
return &option{optionType: minSeverityOption, value: NewMinSeverityFilter(minSev)}
} | [
"func",
"NewMinSeverityOption",
"(",
"minSev",
"api",
".",
"SeverityType",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"optionType",
":",
"minSeverityOption",
",",
"value",
":",
"NewMinSeverityFilter",
"(",
"minSev",
")",
"}",
"\n",
"}"
] | // NewMinSeverityOption provides an option to be used during filter creation that
// accept such options. Only filters that are efficient in querying kvdb accept options
// and apply these options during matching alerts. | [
"NewMinSeverityOption",
"provides",
"an",
"option",
"to",
"be",
"used",
"during",
"filter",
"creation",
"that",
"accept",
"such",
"options",
".",
"Only",
"filters",
"that",
"are",
"efficient",
"in",
"querying",
"kvdb",
"accept",
"options",
"and",
"apply",
"these... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L43-L45 |
21,992 | libopenstorage/openstorage | alerts/api.go | NewFlagCheckOption | func NewFlagCheckOption(flag bool) Option {
return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(flag)}
} | go | func NewFlagCheckOption(flag bool) Option {
return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(flag)}
} | [
"func",
"NewFlagCheckOption",
"(",
"flag",
"bool",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"optionType",
":",
"flagCheckOption",
",",
"value",
":",
"NewFlagCheckFilter",
"(",
"flag",
")",
"}",
"\n",
"}"
] | // NewFlagCheckOptions provides an option to be used during filter creation that
// accept such options. Only filters that are efficient in querying kvdb accept options
// and apply these options during matching alerts. | [
"NewFlagCheckOptions",
"provides",
"an",
"option",
"to",
"be",
"used",
"during",
"filter",
"creation",
"that",
"accept",
"such",
"options",
".",
"Only",
"filters",
"that",
"are",
"efficient",
"in",
"querying",
"kvdb",
"accept",
"options",
"and",
"apply",
"these"... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L50-L52 |
21,993 | libopenstorage/openstorage | alerts/api.go | NewResourceIdOption | func NewResourceIdOption(resourceId string) Option {
return &option{optionType: resourceIdOption, value: NewMatchResourceIDFilter(resourceId)}
} | go | func NewResourceIdOption(resourceId string) Option {
return &option{optionType: resourceIdOption, value: NewMatchResourceIDFilter(resourceId)}
} | [
"func",
"NewResourceIdOption",
"(",
"resourceId",
"string",
")",
"Option",
"{",
"return",
"&",
"option",
"{",
"optionType",
":",
"resourceIdOption",
",",
"value",
":",
"NewMatchResourceIDFilter",
"(",
"resourceId",
")",
"}",
"\n",
"}"
] | // NewResourceIdOption provides an option to be used during filter creation that
// accept such options. Only filters that are efficient in querying kvdb accept options
// and apply these options during matching alerts. | [
"NewResourceIdOption",
"provides",
"an",
"option",
"to",
"be",
"used",
"during",
"filter",
"creation",
"that",
"accept",
"such",
"options",
".",
"Only",
"filters",
"that",
"are",
"efficient",
"in",
"querying",
"kvdb",
"accept",
"options",
"and",
"apply",
"these"... | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L57-L59 |
21,994 | libopenstorage/openstorage | alerts/api.go | NewTimeSpanFilter | func NewTimeSpanFilter(start, stop time.Time) Filter {
return &filter{filterType: timeSpanFilter, value: timeZone{start: start, stop: stop}}
} | go | func NewTimeSpanFilter(start, stop time.Time) Filter {
return &filter{filterType: timeSpanFilter, value: timeZone{start: start, stop: stop}}
} | [
"func",
"NewTimeSpanFilter",
"(",
"start",
",",
"stop",
"time",
".",
"Time",
")",
"Filter",
"{",
"return",
"&",
"filter",
"{",
"filterType",
":",
"timeSpanFilter",
",",
"value",
":",
"timeZone",
"{",
"start",
":",
"start",
",",
"stop",
":",
"stop",
"}",
... | // NewTimeSpanFilter creates a filter that matches on alert raised in a given time window. | [
"NewTimeSpanFilter",
"creates",
"a",
"filter",
"that",
"matches",
"on",
"alert",
"raised",
"in",
"a",
"given",
"time",
"window",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L83-L85 |
21,995 | libopenstorage/openstorage | alerts/api.go | NewCountSpanFilter | func NewCountSpanFilter(minCount, maxCount int64) Filter {
return &filter{filterType: countSpanFilter, value: []int64{minCount, maxCount}}
} | go | func NewCountSpanFilter(minCount, maxCount int64) Filter {
return &filter{filterType: countSpanFilter, value: []int64{minCount, maxCount}}
} | [
"func",
"NewCountSpanFilter",
"(",
"minCount",
",",
"maxCount",
"int64",
")",
"Filter",
"{",
"return",
"&",
"filter",
"{",
"filterType",
":",
"countSpanFilter",
",",
"value",
":",
"[",
"]",
"int64",
"{",
"minCount",
",",
"maxCount",
"}",
"}",
"\n",
"}"
] | // NewCountSpanFilter provides a filter that matches on alert count. | [
"NewCountSpanFilter",
"provides",
"a",
"filter",
"that",
"matches",
"on",
"alert",
"count",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L100-L102 |
21,996 | libopenstorage/openstorage | alerts/api.go | NewMinSeverityFilter | func NewMinSeverityFilter(minSev api.SeverityType) Filter {
return &filter{filterType: minSeverityFilter, value: minSev}
} | go | func NewMinSeverityFilter(minSev api.SeverityType) Filter {
return &filter{filterType: minSeverityFilter, value: minSev}
} | [
"func",
"NewMinSeverityFilter",
"(",
"minSev",
"api",
".",
"SeverityType",
")",
"Filter",
"{",
"return",
"&",
"filter",
"{",
"filterType",
":",
"minSeverityFilter",
",",
"value",
":",
"minSev",
"}",
"\n",
"}"
] | // NewMinSeverityFilter provides a filter that matches on alert when severity is greater than
// or equal to the minSev value. | [
"NewMinSeverityFilter",
"provides",
"a",
"filter",
"that",
"matches",
"on",
"alert",
"when",
"severity",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"minSev",
"value",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L106-L108 |
21,997 | libopenstorage/openstorage | alerts/api.go | NewDeleteAction | func NewDeleteAction(filters ...Filter) Action {
return &action{action: deleteAction, filters: filters, f: deleteActionFunc}
} | go | func NewDeleteAction(filters ...Filter) Action {
return &action{action: deleteAction, filters: filters, f: deleteActionFunc}
} | [
"func",
"NewDeleteAction",
"(",
"filters",
"...",
"Filter",
")",
"Action",
"{",
"return",
"&",
"action",
"{",
"action",
":",
"deleteAction",
",",
"filters",
":",
"filters",
",",
"f",
":",
"deleteActionFunc",
"}",
"\n",
"}"
] | // Action API
// NewDeleteAction deletes alert entries based on filters. | [
"Action",
"API",
"NewDeleteAction",
"deletes",
"alert",
"entries",
"based",
"on",
"filters",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L123-L125 |
21,998 | libopenstorage/openstorage | alerts/api.go | NewClearAction | func NewClearAction(filters ...Filter) Action {
return &action{action: clearAction, filters: filters, f: clearActionFunc}
} | go | func NewClearAction(filters ...Filter) Action {
return &action{action: clearAction, filters: filters, f: clearActionFunc}
} | [
"func",
"NewClearAction",
"(",
"filters",
"...",
"Filter",
")",
"Action",
"{",
"return",
"&",
"action",
"{",
"action",
":",
"clearAction",
",",
"filters",
":",
"filters",
",",
"f",
":",
"clearActionFunc",
"}",
"\n",
"}"
] | // NewClearAction marks alert entries as cleared that get deleted after half a day of life in kvdb. | [
"NewClearAction",
"marks",
"alert",
"entries",
"as",
"cleared",
"that",
"get",
"deleted",
"after",
"half",
"a",
"day",
"of",
"life",
"in",
"kvdb",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L128-L130 |
21,999 | libopenstorage/openstorage | alerts/api.go | NewCustomAction | func NewCustomAction(f func(manager Manager, filters ...Filter) error, filters ...Filter) Action {
return &action{action: CustomAction, filters: filters, f: f}
} | go | func NewCustomAction(f func(manager Manager, filters ...Filter) error, filters ...Filter) Action {
return &action{action: CustomAction, filters: filters, f: f}
} | [
"func",
"NewCustomAction",
"(",
"f",
"func",
"(",
"manager",
"Manager",
",",
"filters",
"...",
"Filter",
")",
"error",
",",
"filters",
"...",
"Filter",
")",
"Action",
"{",
"return",
"&",
"action",
"{",
"action",
":",
"CustomAction",
",",
"filters",
":",
... | // NewCustomAction takes custom action using user defined function. | [
"NewCustomAction",
"takes",
"custom",
"action",
"using",
"user",
"defined",
"function",
"."
] | 71b7f37f99c70e697aa31ca57fa8fb1404629329 | https://github.com/libopenstorage/openstorage/blob/71b7f37f99c70e697aa31ca57fa8fb1404629329/alerts/api.go#L133-L135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.