Mkdir makes the directory (container, bucket)
(ctx context.Context, dir string)
| 1151 | |
| 1152 | // Mkdir makes the directory (container, bucket) |
| 1153 | func (f *Fs) Mkdir(ctx context.Context, dir string) error { |
| 1154 | fs.Debugf(f, "mkdir '%s'", dir) |
| 1155 | err := f.Fs.Mkdir(ctx, dir) |
| 1156 | if err != nil { |
| 1157 | return err |
| 1158 | } |
| 1159 | fs.Debugf(dir, "mkdir: created dir in source fs") |
| 1160 | |
| 1161 | cd := NewDirectory(f, cleanPath(dir)) |
| 1162 | err = f.cache.AddDir(cd) |
| 1163 | if err != nil { |
| 1164 | fs.Errorf(dir, "mkdir: add error: %v", err) |
| 1165 | } else { |
| 1166 | fs.Debugf(cd, "mkdir: added to cache") |
| 1167 | } |
| 1168 | // expire parent of new dir |
| 1169 | parentCd := NewDirectory(f, cleanPath(path.Dir(dir))) |
| 1170 | err = f.cache.ExpireDir(parentCd) |
| 1171 | if err != nil { |
| 1172 | fs.Errorf(parentCd, "mkdir: cache expire error: %v", err) |
| 1173 | } else { |
| 1174 | fs.Infof(parentCd, "mkdir: cache expired") |
| 1175 | } |
| 1176 | // advertise to ChangeNotify if wrapped doesn't do that |
| 1177 | f.notifyChangeUpstreamIfNeeded(parentCd.Remote(), fs.EntryDirectory) |
| 1178 | |
| 1179 | return nil |
| 1180 | } |
| 1181 | |
| 1182 | // Rmdir removes the directory (container, bucket) if empty |
| 1183 | func (f *Fs) Rmdir(ctx context.Context, dir string) error { |