The following table illustrates the behavior of DiskStorage::create/DiskStorageWithRollback::create of each AccessMode and CreationMode combination.
| AccessMode | CreationMode | Description | When the file exists | When the file not exist |
|---|---|---|---|---|
| accessRead | creationDefault | Identical to openExisting | Open it | Fail |
| openExisting | If the file exists, opening it in read-only mode. If the file does not exist, the function fails. | Open it | Fail | |
| openAlways | If the file exists, opening it in read-only mode. If the file does not exist, the function automatically create a new file and open it in read-only mode. | Open it | Create New | |
| createNew | If the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in read-only mode. | Fail | Create New | |
| createAlways | The function always create a new file and open it in read-only mode. (Not frequently used.) | Truncate it | Create New | |
| truncateExisting | If the file exists, the function removes all the content of it and opening it in read-only mode. If the file does not exist, the function fails. | Fail | Fail | |
| accessWrite | creationDefault | Identical to createAlways | Truncate it | Create New |
| openExisting | If the file exists, opening it in write-only mode. If the file does not exist, the function fails. | Open it (to overwrite) | Fail | |
| openAlways | If the file exists, the function open it in write-only mode. If the file does not exist, the function create a new file and open it in write-only mode. | Open it (to overwrite) | Create New | |
| createNew | If the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in write-only mode. | Fail | Create New | |
| createAlways | The function always create a new file and open it in write-only mode. | Truncate it | Create New | |
| truncateExisting | If the file exists, the function removes all the content of it and opening it in write-only mode. If the file does not exist, the function fails. | Truncate it | Fail | |
| accessRW | creationDefault | Identical to openAlways | Open it (to overwrite) | Create New |
| openExisting | If the file exists, opening it in read-write mode. If the file does not exist, the function fails. | Open it (to overwrite) | Fail | |
| openAlways | If the file exists, the function open it in read-write mode. If the file does not exist, the function create a new file and open it in read-write mode. | Open it (to overwrite) | Create New | |
| createNew | If the file already exists, the function fails. If the file does not exist, the function creates a new file and open it in read-write mode. | Fail | Create New | |
| createAlways | The function always create a new file and open it in read-write mode. | Truncate it | Create New | |
| truncateExisting | If the file exists, the function removes all the content of it and opening it in read-write mode. If the file does not exist, the function fails. | Truncate it | Fail |
The terms used in 'When the file exists' and 'When the file not exist' are defined as follows: