View Javadoc
1   package org.kuali.common.devops.archive.s3;
2   
3   import static org.kuali.common.core.base.WeightScale.fileSize;
4   
5   import com.google.common.base.Function;
6   
7   public enum KeyFileWeigher implements Function<KeyFile, Double> {
8   	INSTANCE;
9   
10  	@Override
11  	public Double apply(KeyFile input) {
12  		double weight = fileSize().apply(input.getFile());
13  		// Make sure even zero byte files have a little weight
14  		// We don't have to transfer any bytes across the network but we do have to create an S3 bucket entry
15  		return (weight == 0D) ? 0.1D : weight;
16  	}
17  
18  }