Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.OKB/3.3/Interfaces/IDataService.cs @ 4313

Last change on this file since 4313 was 4279, checked in by swagner, 14 years ago

Integrated OKB services (#1166)

File size: 3.6 KB
Line 
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
22using System.Net.Security;
23using System.ServiceModel;
24
25namespace HeuristicLab.Services.OKB {
26
27  /// <summary>
28  /// Choose between <see cref="Algorithm"/> or <see cref="Problem"/>.
29  /// </summary>
30  public enum EntityType {
31    /// <summary>
32    /// Selects <see cref="Algorithm"/> as entity type.
33    /// </summary>
34    Algorithm,
35    /// <summary>
36    /// Use <see cref="Problem"/> as entity type.
37    /// </summary>
38    Problem
39  };
40
41  /// <summary>
42  /// Download and upload serialized implementations of <see cref="Algorithm"/>s and <see cref="Problem"/>s.
43  /// The transfer has to be initiate through either <see cref="IDataService.Request"/> or <see cref="IDataService.Submit"/>
44  /// followed by either <see cref="IDataService.GetNextChunk"/> or <see cref="IDataService.SetNextChunk"/> and terminated
45  /// with either <see cref="IDataService.TransferDone"/> or <see cref="IDataService.AbortTransfer"/>.
46  /// </summary>
47  [ServiceContract(SessionMode = SessionMode.Required, ProtectionLevel = ProtectionLevel.EncryptAndSign)]
48  public interface IDataService {
49
50    /// <summary>
51    /// Request the specified <see cref="Algorithm"/> or <see cref="Problem"/>.
52    /// </summary>
53    /// <param name="type">The entity type.</param>
54    /// <param name="id">The entity id.</param>
55    /// <returns>The size of the data blob.</returns>
56    [OperationContract(IsInitiating = true, IsTerminating = false)]
57    int Request(EntityType type, int id);
58
59    /// <summary>
60    /// Prepare submission of the specified <see cref="Algorithm"/> or <see cref="Problem"/>.
61    /// </summary>
62    /// <param name="type">The entity type.</param>
63    /// <param name="id">The entity id.</param>
64    [OperationContract(IsInitiating = true, IsTerminating = false)]
65    void Submit(EntityType type, int id);
66
67    /// <summary>
68    /// Gets the next chunk of bytes.
69    /// </summary>
70    /// <param name="size">The maximum number of bytes to transfer.</param>
71    /// <returns>An array of bytes.</returns>
72    [OperationContract(IsInitiating = false, IsTerminating = false)]
73    byte[] GetNextChunk(int size);
74
75    /// <summary>
76    /// Sets the next chunk of bytes.
77    /// </summary>
78    /// <param name="data">The data.</param>
79    [OperationContract(IsInitiating = false, IsTerminating = false)]
80    void SetNextChunk(byte[] data);
81
82    /// <summary>
83    /// Commits the transaction in case of an upload and closes
84    /// the connection.
85    /// </summary>
86    [OperationContract(IsInitiating = false, IsTerminating = true)]
87    void TransferDone();
88
89    /// <summary>
90    /// Aborts the transfer.
91    /// </summary>
92    [OperationContract(IsInitiating = false, IsTerminating = true)]
93    void AbortTransfer();
94  }
95
96}
Note: See TracBrowser for help on using the repository browser.