Permalink
Browse files

container creation, create, read, write file operations

  • Loading branch information...
1 parent 6db5928 commit 3851edd18636b5e78166cac3aea9fca0f43e9557 igor maloletniy committed Apr 20, 2012
View
@@ -1 +1,56 @@
-test
+Please design and implement a library to emulate the file system, consisting of directory tree and paths,
+ which stores all data in one single file.
+
+Create-write-read-append-delete-rename-move operations should be supported.
+Keep balance between container file size and CPU resources.
+Provide a unit tests for all features, with coverage report.
+
+Start with a design overview and estimates.
+Log all your work, decisions and problems encountered in this document
+Append dated sections only.
+Please use English only.
+Conclude with performance and scalability analysis of final solution (CPU/RAM/DISK).
+
+Store project at GitHub or BitBucket git repo, include link here.
+This should be an IDEA project with working “all tests” run config ready to run on any os immediately after checkout.
+Do not use any libs except unit test libs and logging libs.
+
+Time is not limited, but you need to follow your own estimate or provide new.
+Be ready to answer questions on design, implementation and amending your code at final interview.
+
+
+cluster size(512b)
+node:
+name: root
+type: d
+links:
+{
+name: text.txt
+type: f
+data: 1024 - 4 block
+,
+name: bin
+type: d
+links: {
+ name: hello.bin
+ data:2048 - 8 block
+ }
+}
+(node size)+0:
+(node size)+512:
+(node size)+1024: gjggjgjgjgjfjjef,-1 |512b
+(node size)+1536:
+(node size)+2048: addwaawfawfaw,-1 |512b
+
+
+cluster(default 1024b):
+ 1 byte full\empty
+ 8 bytes link to next cluster
+ 1015 bytes data
+
+node:
+ 256 subnodes (long) \ 256 pointer to data (long) | 8b * 256
+ name (char[16]) 2b*16
+ type (char) 2b
+ size (long) 4b
+ node size: 2086bytes
View
10 VFS.iml
@@ -4,9 +4,19 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library" scope="TEST">
+ <library>
+ <CLASSES>
+ <root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.8.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
</component>
</module>
@@ -0,0 +1,26 @@
+package ru.mltny.vfs;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: maloletniy
+ * Date: 4/18/12
+ * Time: 1:59 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public final class Settings {
+
+ public static final short MAX_DIR_COUNT = 16;
+
+ public static final short MAX_NAME_LENGTH = 16;
+
+ public static final int CLUSTER_SIZE_BYTES = 1024;
+
+ public static final int CLUSTER_COUNT = 100000;
+
+ public static final int NODE_SIZE_BYTES = 166;
+
+ public static final int NODE_COUNT = CLUSTER_COUNT / 4;
+
+ public static final long CLUSTER_FIRST_ADDRESS = NODE_COUNT * NODE_SIZE_BYTES;
+
+}
@@ -0,0 +1,32 @@
+package ru.mltny.vfs;
+
+import ru.mltny.vfs.units.Node;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: maloletniy
+ * Date: 4/15/12
+ * Time: 5:36 PM
+ * Interface of main library functionality
+ */
+public interface VFSTools {
+
+ public void create(char type, String name, Node parent) throws Exception;
+
+ public void write(Node node, byte[] bytes) throws Exception;
+
+ public byte[] read(Node node) throws Exception;
+
+ public void append(long node, byte[] bytes) throws Exception;
+
+ public void rename(String path, String name) throws Exception;
+
+ public void delete(String path) throws Exception;
+
+ public void move(String path1, String path2) throws Exception;
+
+ public Node getNodeByPath(long link) throws IOException;
+
+}
Oops, something went wrong.

0 comments on commit 3851edd

Please sign in to comment.