コード例 #1
0
 /// <summary>
 /// gets session meta data associated with a session id using the provided key
 /// </summary>
 /// <param name="sessionId"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public Option <ValueVector> GetDataByKey(SessionId sessionId, string key) =>
 from c in cluster
 from f in c.GetHashFieldDropOnDeserialiseFailed <SessionDataItemDTO>(SessionKey(sessionId), key)
 from o in SessionDataTypeResolve.TryDeserialise(f.SerialisedData, f.Type)
 .MapLeft(SessionDataTypeResolve.DeserialiseFailed(f.SerialisedData, f.Type))
 .ToOption()
 select ValueVector.New(0, o);
コード例 #2
0
        public int Incoming(SessionAction incoming)
        {
            if (incoming.SystemName == system.Value && incoming.NodeName == nodeName.Value)
            {
                return(0);
            }

            switch (incoming.Tag)
            {
            case SessionActionTag.Touch:
                Touch(incoming.SessionId);
                break;

            case SessionActionTag.Start:
                Start(incoming.SessionId, incoming.Timeout, Map <string, object>());
                break;

            case SessionActionTag.Stop:
                Stop(incoming.SessionId);
                break;

            case SessionActionTag.SetData:
                SessionDataTypeResolve.TryDeserialise(incoming.Value, incoming.Type)
                .Map(o => SetData(incoming.SessionId, incoming.Key, o, incoming.Time))
                .IfLeft(SessionDataTypeResolve.DeserialiseFailed(incoming.Value, incoming.Type));
                break;

            case SessionActionTag.ClearData:
                ClearData(incoming.SessionId, incoming.Key, incoming.Time);
                break;

            default:
                return(0);
            }
            return(1);
        }