[4279] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System.Net.Security;
|
---|
| 23 | using System.ServiceModel;
|
---|
| 24 |
|
---|
| 25 | namespace HeuristicLab.Services.OKB {
|
---|
| 26 | /// <summary>
|
---|
| 27 | /// Choose between <see cref="Algorithm"/> or <see cref="Problem"/>.
|
---|
| 28 | /// </summary>
|
---|
| 29 | public enum EntityType {
|
---|
| 30 | /// <summary>
|
---|
[4381] | 31 | /// Use <see cref="Algorithm"/> as entity type.
|
---|
[4279] | 32 | /// </summary>
|
---|
| 33 | Algorithm,
|
---|
| 34 | /// <summary>
|
---|
| 35 | /// Use <see cref="Problem"/> as entity type.
|
---|
| 36 | /// </summary>
|
---|
| 37 | Problem
|
---|
| 38 | };
|
---|
| 39 |
|
---|
| 40 | /// <summary>
|
---|
| 41 | /// Download and upload serialized implementations of <see cref="Algorithm"/>s and <see cref="Problem"/>s.
|
---|
| 42 | /// The transfer has to be initiate through either <see cref="IDataService.Request"/> or <see cref="IDataService.Submit"/>
|
---|
| 43 | /// followed by either <see cref="IDataService.GetNextChunk"/> or <see cref="IDataService.SetNextChunk"/> and terminated
|
---|
| 44 | /// with either <see cref="IDataService.TransferDone"/> or <see cref="IDataService.AbortTransfer"/>.
|
---|
| 45 | /// </summary>
|
---|
| 46 | [ServiceContract(SessionMode = SessionMode.Required, ProtectionLevel = ProtectionLevel.EncryptAndSign)]
|
---|
| 47 | public interface IDataService {
|
---|
| 48 |
|
---|
| 49 | /// <summary>
|
---|
| 50 | /// Request the specified <see cref="Algorithm"/> or <see cref="Problem"/>.
|
---|
| 51 | /// </summary>
|
---|
| 52 | /// <param name="type">The entity type.</param>
|
---|
| 53 | /// <param name="id">The entity id.</param>
|
---|
| 54 | /// <returns>The size of the data blob.</returns>
|
---|
| 55 | [OperationContract(IsInitiating = true, IsTerminating = false)]
|
---|
| 56 | int Request(EntityType type, int id);
|
---|
| 57 |
|
---|
| 58 | /// <summary>
|
---|
| 59 | /// Prepare submission of the specified <see cref="Algorithm"/> or <see cref="Problem"/>.
|
---|
| 60 | /// </summary>
|
---|
| 61 | /// <param name="type">The entity type.</param>
|
---|
| 62 | /// <param name="id">The entity id.</param>
|
---|
| 63 | [OperationContract(IsInitiating = true, IsTerminating = false)]
|
---|
| 64 | void Submit(EntityType type, int id);
|
---|
| 65 |
|
---|
| 66 | /// <summary>
|
---|
| 67 | /// Gets the next chunk of bytes.
|
---|
| 68 | /// </summary>
|
---|
| 69 | /// <param name="size">The maximum number of bytes to transfer.</param>
|
---|
| 70 | /// <returns>An array of bytes.</returns>
|
---|
| 71 | [OperationContract(IsInitiating = false, IsTerminating = false)]
|
---|
| 72 | byte[] GetNextChunk(int size);
|
---|
| 73 |
|
---|
| 74 | /// <summary>
|
---|
| 75 | /// Sets the next chunk of bytes.
|
---|
| 76 | /// </summary>
|
---|
| 77 | /// <param name="data">The data.</param>
|
---|
| 78 | [OperationContract(IsInitiating = false, IsTerminating = false)]
|
---|
| 79 | void SetNextChunk(byte[] data);
|
---|
| 80 |
|
---|
| 81 | /// <summary>
|
---|
| 82 | /// Commits the transaction in case of an upload and closes
|
---|
| 83 | /// the connection.
|
---|
| 84 | /// </summary>
|
---|
| 85 | [OperationContract(IsInitiating = false, IsTerminating = true)]
|
---|
| 86 | void TransferDone();
|
---|
| 87 |
|
---|
| 88 | /// <summary>
|
---|
| 89 | /// Aborts the transfer.
|
---|
| 90 | /// </summary>
|
---|
| 91 | [OperationContract(IsInitiating = false, IsTerminating = true)]
|
---|
| 92 | void AbortTransfer();
|
---|
| 93 | }
|
---|
| 94 | }
|
---|