git_bsmd/nsw/Source/bsmd.LockingService/IService.cs

74 lines
2.4 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)]
bool Lock(Guid messageCoreId, string userId);
/// <summary>
/// Relinquish lock for a particular core
/// </summary>
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void Unlock(Guid messageCoreId, string userId);
/// <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, string 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, string userId);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
}