Commit Graph

36 Commits

Author SHA1 Message Date
Steve Francia fe8e895336 Migrate all backends & readme to use constructorish New... 2016-01-11 21:41:03 -05:00
Martin Bertschler 6a67f8a50b Remove FileExists error in MemMapFs.Rename when destination file exists, because os.Rename also doesn't return the error 2016-01-07 11:47:44 +01:00
Martin Bertschler f0b9fc1bdb Implement and test read only MemMapFs file handles
Fixes #53
2016-01-04 01:54:48 +01:00
Martin Bertschler a5f01f1106 replace mem.File handles with mem.FileData when mem.FileData is all we need 2016-01-04 00:36:01 +01:00
Martin Bertschler 0321b04b21 fix mem.DirMap and mem.Dir to only use *FileData and not *File handles 2016-01-04 00:18:26 +01:00
Martin Bertschler 7096d68458 mem.File is now mem.FileData and mem.File is a file handle with a pointer to a mem.FileData 2016-01-03 23:59:42 +01:00
Martin Bertschler 98ed0a3409 return improved errors from MemMapFs methods
MemMapFs.Mkdir now returns an error if the file or dir already exists
MemMapFs.Remove now returns an error if the file or dir doesn't exists

fixes #43
2015-12-20 22:09:09 +01:00
Bjørn Erik Pedersen 2101bdf57c Unexport the RWMutex in MemMapFs 2015-12-18 21:26:04 +01:00
Bjørn Erik Pedersen 7e65370ebb Remove unused mutex 2015-12-18 19:49:23 +01:00
Bjørn Erik Pedersen 75b0bd216a Fix data races in MemMapFs
Also simplifiy the lock constructs.

Fixes #44
Fixes #45
2015-12-18 19:20:45 +01:00
Steve Francia 12f79b29b2 Update mem to keep things private 2015-12-10 15:13:36 -05:00
Steve Francia 4b2ab283a0 add debugging method for MemMapFs 2015-12-10 15:13:17 -05:00
Martin Bertschler 37f7afc8d7 Fix artefacts from moving MemMapFs types into subpackage mem 2015-12-10 18:55:43 +01:00
Steve Francia 965d098e7c Moving memory structures and interfaces into sub package 2015-12-10 12:26:38 -05:00
Steve Francia 943d877c43 Fix remaining Windows bugs and tests 2015-12-09 15:37:15 -05:00
Steve Francia daf7a87d8f Make "findParent" work on Windows properly
Fixes #31
2015-12-08 21:48:19 -05:00
Steve Francia f50d862134 Adding "/" to MemMapFS in a cleaner way 2015-12-08 16:24:09 -05:00
Steve Francia a9385f2db9 Removing extra normalize call
(since open already normalizes)
2015-12-08 16:24:09 -05:00
Steve Francia 54ad8f690d MkdirAll should respect permissions (MemMapFS) 2015-12-08 16:24:09 -05:00
Steve Francia 3a224e9827 Normalize Paths so "/boo/" and "/boo" are the same 2015-12-03 09:45:14 -05:00
Steve Francia 75dc847d59 Start MemMapFS with a root directory. 2015-12-02 16:27:14 -05:00
Martin Bertschler 5a59c3f940 properly rename files by changing file.name and newly registering with parent 2015-11-22 14:34:57 +01:00
spf13 3f6f746a75 Treat existing files and directories differently in MemMapFS. 2015-11-16 21:26:16 -05:00
Martin Bertschler 0a58b8245b Fix a bug that happens when the parent is the "." file. 2015-11-07 01:33:53 +01:00
Alex Tomlins 582dcbe54c Support O_TRUNC flag to MemMapFs.OpenFile
To truncate an existing file when opening.
2015-11-05 06:59:56 -05:00
Alex Tomlins 7441922445 Support O_APPEND flag in *MemMapFs.Openfile
To allow opening an existing file in append mode.
2015-11-05 06:59:56 -05:00
Alex Tomlins 47e9336de6 Handle O_CREATE flag to *MemMapFs.OpenFile.
To allow MemMapFs to be used in place of OsFs in tests where this flag
is used to create the file if it doesn't already exist..
2015-11-05 06:59:56 -05:00
Martin Bertschler 10150bfa64 fix Readdir behaviour for n > 0, fix RemoveAll 2015-11-04 20:33:40 +01:00
Martin Bertschler 3de0cfae06 make Readdir and Readdirnames work
+ fix registerWithParent function
+ fix unRegisterWithParent and use it in Remove and RemoveAll
+ fix findParent function
+ add lock free versions of Mkdir and Open for the use during register and unregistering with parent, so that these changes happen atomical
2015-10-17 12:58:11 +02:00
Alex Tomlins 6ced24dbe1 Make MemMapFs.Remove() error for non-existent file
So that it's consistent with the os package.
2015-09-08 08:16:57 -04:00
Alex Tomlins a269144fd6 Fix MemMapFs.Remove() to really delete the file.
It was attempting to delete a file with a hardcoded path of "name" as
opposed to the path in the `name` variable.

Fixing this exposed a deadlock because the function was attempting to
acquire an exclusive lock when it already had a read lock.
2015-09-08 08:16:57 -04:00
Anton Tiurin 5849bf9936 [MemMap] Fix a data race
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-09-08 08:15:56 -04:00
spf13 f20e72f15f adding List function to memmapfs 2014-12-12 13:32:57 -05:00
spf13 f5d2472495 Adding proper open support for memfile 2014-10-31 23:38:54 -04:00
spf13 0c3b992fe6 Adding chmod and chtimes support. 2014-10-31 23:36:45 -04:00
spf13 0bc61700a3 afero is born 2014-10-28 10:29:28 -04:00