git_bsmd/bsmd.LockingService/IService.cs

75 lines
3.0 KiB
C#

// Copyright (c) 2017 schick Informatik
// Description:
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
namespace bsmd.LockingService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService
{
/// <summary>
/// Request a lock for a particular core
/// </summary>
/// <returns>true if successful</returns>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Guid Lock(Guid messageCoreId, Guid userId);
/// <summary>
/// Relinquish lock for a particular core
/// </summary>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void Unlock(Guid messageCoreId, Guid userId);
/// <summary>
/// Get all locks currently in use (for search result..)
/// </summary>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
List<CoreLock> GetLocks();
/// <summary>
/// To avoid Timeout, send keepalive message
/// </summary>
/// <param name="currentLocks">currently held locks</param>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void LockRefresh(List<Guid> currentLocks, Guid userId);
/// <summary>
/// send a log message (convenience helper)
/// </summary>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void Log(string msg, string host, Guid userId);
/// <summary>
/// Get current overview of sent/corrupted/open files (His-Nord)
/// </summary>
/// <returns></returns>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
ServerStatus GetStatus();
/// <summary>
/// Takes this file from the "READY" Folder and copies contents back in the database (restore from unvoluntary overwrite)
/// </summary>
/// <param name="filename"></param>
/// <returns>true on success</returns>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
bool RestoreFromFile(string filename);
}
}