Skip to content

Commit

Permalink
Merge pull request #1 from sheeep/release-1.0
Browse files Browse the repository at this point in the history
Documentation fixes.
  • Loading branch information
mitom committed Oct 11, 2013
2 parents 71d6118 + 207d2f1 commit 80ba434
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
20 changes: 10 additions & 10 deletions Resources/doc/chunked_uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ oneup_uploader:
You can choose a custom directory to save the chunks temporarily while uploading by changing the parameter `directory`.

Since version 1.0 you can also use a Gaufrette filesystem as the chunk storage. To do this you must first
set up [Gaufrette](gaufrette_storage.md).There are however some additional things to keep in mind.
set up [Gaufrette](gaufrette_storage.md). There are however some additional things to keep in mind.
The configuration for the Gaufrette chunk storage should look as the following:
```
oneup_uploader:
chunks:
maxage: 86400
storage:
type: gaufrette
filesystem: gaufrette.gallery_filesystem
filesystem: gaufrette.gallery_filesystem
prefix: 'chunks'
stream_wrapper: 'gaufrette://gallery/'
```

> Setting the stream_wrapper is heavily recommended for better performance, see the reasons in the [gaufrette configuration](gaufrette_storage.md#configure-your-mappings)
> Setting the `stream_wrapper` is heavily recommended for better performance, see the reasons in the [gaufrette configuration](gaufrette_storage.md#configure-your-mappings)
As you can see there are is a new option, ```prefix```. It represents the directory
As you can see there are is a new option, `prefix`. It represents the directory
*relative* to the filesystem's directory which the chunks are stored in.
Gaufrette won't allow it to be outside of the filesystem.

> You can only use stream capable filesystems for the chunk storage, at the time of this writing
only the Local filesystem is capable of streaming directly.

This will give you a better structured directory,
as the chunk's folders and the uploaded files won't mix with each other.
> You can set it to an empty string (```''```), if you don't need it. Otherwise it defaults to ```chunks```.
as the chunk's folders and the uploaded files won't mix with each other.
> You can set it to an empty string (`''`), if you don't need it. Otherwise it defaults to `chunks`.
The chunks will be read directly from the tmp and appended to the already existing part on the given filesystem,
The chunks will be read directly from the temporary directory and appended to the already existing part on the given filesystem,
resulting in only 1 read and 1 write operation.

You can achieve the biggest improvement if you use the same filesystem as your storage, as if you do so, the assembled
file only has to be moved out of the chunk directory, which on the same filesystem takes almost not time.
You can achieve the biggest improvement if you use the same filesystem as your storage. If you do so, the assembled
file only has to be moved out of the chunk directory, which takes no time on a local filesystem.

> The ```load distribution``` is forcefully turned on, if you use gaufrette as the chunk storage.
> The load distribution is forcefully turned on, if you use Gaufrette as the chunk storage.

## Clean up
Expand Down
20 changes: 10 additions & 10 deletions Resources/doc/gaufrette_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ knp_gaufrette:
local:
directory: %kernel.root_dir%/../web/uploads
create: true

filesystems:
gallery:
adapter: gallery
Expand All @@ -71,7 +71,7 @@ oneup_uploader:
gallery:
storage:
type: gaufrette
filesystem: gaufrette.gallery_filesystem
filesystem: gaufrette.gallery_filesystem
```

You can specify the buffer size used for syncing files from your filesystem to the gaufrette storage by changing the property `sync_buffer_size`.
Expand All @@ -84,7 +84,7 @@ oneup_uploader:
gallery:
storage:
type: gaufrette
filesystem: gaufrette.gallery_filesystem
filesystem: gaufrette.gallery_filesystem
sync_buffer_size: 1M
```

Expand All @@ -97,18 +97,18 @@ oneup_uploader:
gallery:
storage:
type: gaufrette
filesystem: gaufrette.gallery_filesystem
filesystem: gaufrette.gallery_filesystem
stream_wrapper: gaufrette://gallery/
```

> This is only useful if you are using a stream capable adapter, at the time of this writing only
> This is only useful if you are using a stream-capable adapter. At the time of this writing, only
the local adapter is capable of streaming directly.

The first part (```gaufrette```) in the example above ```MUST``` be the same as ```knp_gaufrette.stream_wrapper.protocol```,
the second part (```gallery```) in the example, ```MUST``` be the key of the filesytem (```knp_gaufette.filesystems.key```).
It also must end with a slash (```/```).
The first part (`gaufrette`) in the example above `MUST` be the same as `knp_gaufrette.stream_wrapper.protocol`,
the second part (`gallery`) in the example, `MUST` be the key of the filesytem (`knp_gaufette.filesystems.key`).
It also must end with a slash (`/`).

This is particularly useful if you want to get exact informations about your files. Gaufrette offers you every functionality
to do this without relying on the stream wrapper, however it will have to download the file and load it into memory
to operate on it. If ```stream_wrapper``` is specified the bundle will try to open the file as streams when such operation
is requested.(e.g. getting the size of the file, the mime-type based on content)
to operate on it. If `stream_wrapper` is specified, the bundle will try to open the file as streams when such operation
is requested. (e.g. getting the size of the file, the mime-type based on content)
1 change: 1 addition & 0 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ some more advanced features.
* [Validate your uploads](custom_validator.md)
* [General/Generic Events](events.md)
* [Enable Session upload progress / upload cancelation](progress.md)
* [Use Chunked Uploads behind Load Balancers](load_balancers.md)
* [Configuration Reference](configuration_reference.md)
* [Testing this bundle](testing.md)

Expand Down
6 changes: 6 additions & 0 deletions Resources/doc/load_balancers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Use Chunked Uploads behind Load Balancers
=========================================

If you want to use Chunked Uploads behind load balancers that is not configured to use sticky sessions you'll eventually end up with a bunch of chunks on every instance and the bundle is not able to reassemble the file on the server.

You can avoid this problem by using Gaufrette as an abstract filesystem.

0 comments on commit 80ba434

Please sign in to comment.