-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
741 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Sebastian Stenzel and others. | ||
* Copyright (c) 2016, 2017 Sebastian Stenzel and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the accompanying LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Sebastian Stenzel - initial API and implementation | ||
*******************************************************************************/ | ||
*******************************************************************************/ | ||
package org.cryptomator.cryptofs; | ||
|
||
final class Constants { | ||
public final class Constants { | ||
|
||
public static final int VAULT_VERSION = 6; | ||
public static final String MASTERKEY_BACKUP_SUFFIX = ".bkup"; | ||
public static final String DATA_DIR_NAME = "d"; | ||
public static final String METADATA_DIR_NAME = "m"; | ||
public static final String DIR_PREFIX = "0"; | ||
public static final int NAME_SHORTENING_THRESHOLD = 129; | ||
public static final int VAULT_VERSION = 5; | ||
public static final String ROOT_DIR_ID = ""; | ||
|
||
public static final String SEPARATOR = "/"; | ||
static final String DATA_DIR_NAME = "d"; | ||
static final String METADATA_DIR_NAME = "m"; | ||
static final String DIR_PREFIX = "0"; | ||
static final int NAME_SHORTENING_THRESHOLD = 129; | ||
static final String ROOT_DIR_ID = ""; | ||
|
||
static final String SEPARATOR = "/"; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/org/cryptomator/cryptofs/FileSystemNeedsMigrationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.cryptomator.cryptofs; | ||
|
||
import java.nio.file.FileSystemException; | ||
import java.nio.file.Path; | ||
|
||
import org.cryptomator.cryptofs.migration.Migrators; | ||
|
||
/** | ||
* Indicates that no file system for a given vault can be created, because the vault has been created with an older version of this library. | ||
* | ||
* @see Migrators | ||
* @since 1.4.0 | ||
*/ | ||
public class FileSystemNeedsMigrationException extends FileSystemException { | ||
|
||
public FileSystemNeedsMigrationException(Path pathToVault) { | ||
super(pathToVault.toString(), null, "File system needs migration to a newer format."); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/cryptomator/cryptofs/migration/Migration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Skymatic UG (haftungsbeschränkt). | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the accompanying LICENSE file. | ||
*******************************************************************************/ | ||
package org.cryptomator.cryptofs.migration; | ||
|
||
enum Migration { | ||
/** | ||
* @deprecated for testing only | ||
*/ | ||
@Deprecated ZERO_TO_ONE(0), | ||
|
||
/** | ||
* Migrates vault format 5 to 6. | ||
*/ | ||
FIVE_TO_SIX(5); | ||
|
||
private final int applicableVersion; | ||
|
||
private Migration(int applicableVersion) { | ||
this.applicableVersion = applicableVersion; | ||
} | ||
|
||
public boolean isApplicable(int version) { | ||
return version == applicableVersion; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/cryptomator/cryptofs/migration/MigrationComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Skymatic UG (haftungsbeschränkt). | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the accompanying LICENSE file. | ||
*******************************************************************************/ | ||
package org.cryptomator.cryptofs.migration; | ||
|
||
import dagger.Component; | ||
|
||
@Component(modules = {MigrationModule.class}) | ||
interface MigrationComponent { | ||
|
||
Migrators migrators(); | ||
|
||
} |
Oops, something went wrong.