MCPcopy
hub / github.com/cubefs/cubefs / Next

Method Next

objectnode/util.go:99–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99func (p *PathIterator) Next() PathItem {
100 p.init()
101 if p.cursor >= len(p.path) {
102 return emptyPathItem
103 }
104 var item PathItem
105 index := strings.Index(p.path[p.cursor:], pathSep)
106 if index >= 0 {
107 item = PathItem{
108 Name: p.path[p.cursor : p.cursor+index],
109 IsDirectory: true,
110 }
111 p.cursor = p.cursor + index + 1
112 } else {
113 item = PathItem{
114 Name: p.path[p.cursor:],
115 IsDirectory: false,
116 }
117 p.cursor = len(p.path)
118 }
119 return item
120}
121
122func NewPathIterator(path string) PathIterator {
123 return PathIterator{

Callers 3

recursiveLookupTargetMethod · 0.95
ToSliceMethod · 0.95

Calls 2

initMethod · 0.95
IndexMethod · 0.65

Tested by

no test coverage detected