#region License Information
/* HeuristicLab
* Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System.Net.Security;
using System.ServiceModel;
namespace HeuristicLab.Services.OKB {
///
/// Choose between or .
///
public enum EntityType {
///
/// Use as entity type.
///
Algorithm,
///
/// Use as entity type.
///
Problem
};
///
/// Download and upload serialized implementations of s and s.
/// The transfer has to be initiate through either or
/// followed by either or and terminated
/// with either or .
///
[ServiceContract(SessionMode = SessionMode.Required, ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public interface IDataService {
///
/// Request the specified or .
///
/// The entity type.
/// The entity id.
/// The size of the data blob.
[OperationContract(IsInitiating = true, IsTerminating = false)]
int Request(EntityType type, int id);
///
/// Prepare submission of the specified or .
///
/// The entity type.
/// The entity id.
[OperationContract(IsInitiating = true, IsTerminating = false)]
void Submit(EntityType type, int id);
///
/// Gets the next chunk of bytes.
///
/// The maximum number of bytes to transfer.
/// An array of bytes.
[OperationContract(IsInitiating = false, IsTerminating = false)]
byte[] GetNextChunk(int size);
///
/// Sets the next chunk of bytes.
///
/// The data.
[OperationContract(IsInitiating = false, IsTerminating = false)]
void SetNextChunk(byte[] data);
///
/// Commits the transaction in case of an upload and closes
/// the connection.
///
[OperationContract(IsInitiating = false, IsTerminating = true)]
void TransferDone();
///
/// Aborts the transfer.
///
[OperationContract(IsInitiating = false, IsTerminating = true)]
void AbortTransfer();
}
}