Commit ab67ab1a by olly Committed by Oliver Woodman

Implement database CachedContentIndex.Storage

PiperOrigin-RevId: 231600104
parent c9b848e5
......@@ -408,8 +408,8 @@ public final class SimpleCache implements Cache {
if (isRootDirectory && fileName.indexOf('.') == -1) {
loadDirectory(file, /* isRootDirectory= */ false);
} else {
if (isRootDirectory && CachedContentIndex.FILE_NAME.equals(fileName)) {
// Skip the (expected) index file in the root directory.
if (isRootDirectory && CachedContentIndex.isIndexFile(fileName)) {
// Skip the (expected) index files in the root directory.
continue;
}
long fileLength = file.length();
......
......@@ -151,7 +151,8 @@ public class CachedContentIndexTest {
@Test
public void testLoadV1() throws Exception {
FileOutputStream fos = new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME));
FileOutputStream fos =
new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME_ATOMIC));
fos.write(testIndexV1File);
fos.close();
......@@ -169,7 +170,8 @@ public class CachedContentIndexTest {
@Test
public void testLoadV2() throws Exception {
FileOutputStream fos = new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME));
FileOutputStream fos =
new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME_ATOMIC));
fos.write(testIndexV2File);
fos.close();
......@@ -220,7 +222,7 @@ public class CachedContentIndexTest {
new CachedContentIndex(cacheDir, key), new CachedContentIndex(cacheDir, key));
// Rename the index file from the test above
File file1 = new File(cacheDir, CachedContentIndex.FILE_NAME);
File file1 = new File(cacheDir, CachedContentIndex.FILE_NAME_ATOMIC);
File file2 = new File(cacheDir, "file2compare");
assertThat(file1.renameTo(file2)).isTrue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment