store method

Future<bool> store(
  1. String skinId,
  2. int version,
  3. List<int> bytes
)

Stores one downloaded skin file, then evicts oldest-mtime entries until under the cap. Returns false (and publishes nothing) when the bytes are empty or over the per-file max.

Implementation

Future<bool> store(String skinId, int version, List<int> bytes) {
  if (skinId.isEmpty ||
      version < 0 ||
      bytes.isEmpty ||
      bytes.length > skinFileMaxBytes) {
    return Future.value(false);
  }
  final result = _writeChain.then((_) => _store(skinId, version, bytes));
  _writeChain = result.then((_) {}, onError: (_) {});
  return result;
}