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