2 people like it.

megaton/cluster.fs

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
204: 
205: 
206: 
207: 
208: 
209: 
210: 
211: 
212: 
213: 
214: 
215: 
216: 
217: 
218: 
219: 
220: 
221: 
222: 
223: 
224: 
225: 
226: 
227: 
228: 
229: 
230: 
231: 
232: 
233: 
234: 
235: 
236: 
237: 
238: 
239: 
240: 
241: 
242: 
243: 
244: 
245: 
246: 
247: 
248: 
249: 
250: 
251: 
252: 
253: 
254: 
255: 
256: 
257: 
258: 
259: 
260: 
261: 
262: 
263: 
264: 
265: 
266: 
267: 
268: 
269: 
270: 
// Copyright 2010 Promitheia Technologies

namespace Megaton.Engine

open System
open System.IO
open System.Threading
open Megaton.Model
open Megaton.Serialization
type Dict<'k, 'v> = System.Collections.Generic.Dictionary<'k, 'v>

type CRecord = {
    Position : int64
    Data : RecordData
}

type Cluster (path, name) =
    let mutable c_path = Path.Combine (path, name + ".mt-c")
    let records = Dict<string, CRecord> ()
    let merge_lock = new ReaderWriterLockSlim ()
    let write_lock = obj ()
    let mutable c_st : Stream = null
    let mutable c_bw : BinaryWriter = null
    let mutable c_w = null
    let mutable c_id = (Guid.NewGuid ()).ToByteArray ()
    let c_read fn =
        merge_lock.EnterReadLock ()
        try
            fn ()
        finally
            merge_lock.ExitReadLock ()
    let c_write commit merge =
        lock write_lock
        <| fun _ ->
            let pos = c_st.Position
            merge_lock.EnterReadLock ()
            let res = commit ()
            merge_lock.ExitReadLock ()
            c_bw.Write (c_st.Position - pos)
            c_bw.Write c_id
            c_bw.Flush ()
            merge_lock.EnterWriteLock ()
            try
                merge res
            finally
                merge_lock.ExitWriteLock ()
    let create () =
        c_st <- File.Open (c_path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read)
        c_bw <- new BinaryWriter (c_st)
        c_w <- Writer (c_bw)
        c_bw.Write c_id
        c_bw.Flush ()
    let load () =
        let br = new BinaryReader (c_st)
        let sr = new Reader (br)
        let deld = ResizeArray<string> ()
        let rec follow pos =
            c_st.Seek (pos, SeekOrigin.Begin) |> ignore
            match br.ReadByte () with
            | 6uy ->
                sr.ReadString () |> ignore
                sr.ReadData ()
            | 12uy ->
                sr.ReadString () |> ignore
                let old_pos = br.ReadInt64 ()
                let data_pos = c_st.Position
                let old = follow old_pos
                c_st.Seek (data_pos, SeekOrigin.Begin) |> ignore
                old.Update (sr.ReadData ())
            | 13uy ->
                let ok = sr.ReadString ()
                deld.Add ok
                let nk = sr.ReadString ()
                let old_pos = br.ReadInt64 ()
                follow old_pos
            | _ -> failwith "This transaction is not valid in this context. Corruption."
        c_st.Seek (c_st.Length, SeekOrigin.Begin) |> ignore
        while c_st.Position > 16L do
            c_st.Seek (c_st.Position - 24L, SeekOrigin.Begin) |> ignore
            let len = br.ReadInt64 ()
            let mutable pos = c_st.Position - len - 8L
            c_st.Seek (pos, SeekOrigin.Begin) |> ignore
            match br.ReadByte () with
            | 6uy -> // Set
                let k = sr.ReadString ()
                if not <| records.ContainsKey k && not <| deld.Contains k then do
                    records.Add (k, { Position = pos; Data = sr.ReadData () })
            | 11uy -> // Delete
                let k = sr.ReadString ()
                if not <| records.ContainsKey k && not <| deld.Contains k then do
                    deld.Add k
            | 12uy -> // Update
                let k = sr.ReadString ()
                if not <| records.ContainsKey k && not <| deld.Contains k then do
                    let old_pos = br.ReadInt64 ()
                    let data_pos = c_st.Position
                    let old = follow old_pos
                    c_st.Seek (data_pos, SeekOrigin.Begin) |> ignore
                    records.Add (k, 
                        { Position = pos
                          Data = old.Update (sr.ReadData ()) })
            | 13uy -> // Move
                let ok = sr.ReadString ()
                let nk = sr.ReadString ()
                if not <| records.ContainsKey nk
                   && not <| deld.Contains nk
                   && not <| deld.Contains ok
                   then do
                    let old_pos = br.ReadInt64 ()
                    let old = follow old_pos
                    c_st.Seek (pos + 1L, SeekOrigin.Begin) |> ignore
                    records.Add (nk, { Position = pos; Data = old })
                    if not <| deld.Contains ok then do deld.Add ok
            | 18uy -> // Empty
                pos <- 16L
            | _ ->
                failwith "Unknown transaction. Corruption."
            c_st.Seek (pos, SeekOrigin.Begin) |> ignore
        c_st.Close ()
        c_st <- File.Open (c_path, FileMode.Open, FileAccess.Write, FileShare.Read)
        c_bw <- new BinaryWriter (c_st)
        c_w <- Writer (c_bw)
        c_st.Seek (c_st.Length, SeekOrigin.Begin) |> ignore
    let recover () =
        failwith "Recovery not implemented."
    let reattach () =
        c_st <- File.Open (c_path, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
        let br = new BinaryReader (c_st)
        c_st.Seek (0L, SeekOrigin.Begin) |> ignore
        c_id <- br.ReadBytes 16
        c_st.Seek (c_st.Length - 16L, SeekOrigin.Begin) |> ignore
        let last = br.ReadBytes 16
        if last = c_id then do
            load ()
        else
            recover ()
    do
        if File.Exists c_path then do
            reattach ()
        else do
            create ()
    member self.ClusterDetach () =
        lock write_lock
        |> fun _ ->
            c_st.Close ()
    member self.ClusterDelete () =
        lock write_lock
        |> fun _ ->
            c_st.Close ()
            File.Delete c_path
    member self.ClusterMove n =
        lock write_lock
        |> fun _ ->
            c_st.Close ()
            let new_path = Path.Combine (path, n + ".mt-c")
            File.Move (path, new_path)
            c_path <- new_path
            c_st <- File.Open (c_path, FileMode.Append, FileAccess.ReadWrite, FileShare.Read)
    member self.Get k =
        c_read
        <| fun _ ->
            if records.ContainsKey k then
                Some { Key = k; Data = records.[k].Data }
            else
                None
    member self.Set r =
        c_write
        <| fun _ ->
            let pos = c_st.Position
            c_bw.Write 6uy
            c_w.WriteRecord r
            pos
        <| fun pos ->
            let cr = { Position = pos; Data = r.Data }
            if records.ContainsKey r.Key then do
                records.[r.Key] <- cr
            else do
                records.Add (r.Key, cr)
    member self.Has k =
        c_read
        <| fun _ ->
            records.ContainsKey k
    member self.Head k =
        c_read
        <| fun _ ->
            if records.ContainsKey k then
                let r = records.[k]
                Some {
                    Key = k
                    Type = r.Data.Type
                }
            else
                None
    member self.Count () =
        c_read <| fun _ -> records.Count
    member self.Delete k =
        c_write
        <| fun _ ->
            if records.ContainsKey k then do
                c_bw.Write 11uy
                c_w.WriteString k
        <| fun _ ->
            if records.ContainsKey k then do
                records.Remove k |> ignore
    member self.Update (r : Record) =
        c_write
        <| fun _ ->
            if not <| records.ContainsKey r.Key then failwith "Record not found."
            let pos = c_st.Position
            c_bw.Write 12uy
            c_w.WriteString r.Key
            c_bw.Write records.[r.Key].Position
            c_w.WriteData r.Data
            pos
        <| fun pos ->
            records.[r.Key] <- { Position = pos; Data = records.[r.Key].Data.Update r.Data }
    member self.Move k nk =
        c_write
        <| fun _ ->
            if not <| records.ContainsKey k then do failwith "Record not found."
            let r = records.[k]
            let pos = c_st.Position
            c_bw.Write 13uy
            c_w.WriteString k
            c_w.WriteString nk
            c_bw.Write r.Position
            pos
        <| fun pos ->
            let r = records.[k]
            records.Remove k |> ignore
            let nr = { Position = pos; Data = r.Data }
            if records.ContainsKey nk then do
                records.[nk] <- nr
            else do
                records.Add (nk, nr)
    member self.Dir () =
        c_read
        <| fun _ ->
            [ for r in records -> { Key = r.Key; Type = r.Value.Data.Type } ]
    member self.All () =
        c_read
        <| fun _ ->
            [ for r in records -> { Key = r.Key; Data = r.Value.Data } ]
    member self.Many ks =
        c_read
        <| fun _ ->
            let vks = ks |> List.filter (fun k -> records.ContainsKey k)
            [ for k in vks -> { Key = k; Data = records.[k].Data } ]
    member self.SetMany (rs : Record list) =
        c_write
        <| fun _ ->
            [ for r in rs do
                let pos = c_st.Position
                c_bw.Write 6uy
                c_w.WriteRecord r
                yield r.Key, { Position = pos; Data = r.Data }
            ]
        <| fun crs ->
            for k,cr in crs do
                if records.ContainsKey k then do
                    records.[k] <- cr
                else do
                    records.Add (k, cr)
    member self.Empty () =
        c_write
        <| fun _ -> c_bw.Write 18uy
        <| fun _ ->
            let c = records.Count
            records.Clear ()
            c
namespace System
namespace System.IO
namespace System.Threading
type Dict<'k,'v> = Collections.Generic.Dictionary<'k,'v>

Full name: Megaton.Engine.Dict<_,_>
namespace System.Collections
namespace System.Collections.Generic
Multiple items
type Dictionary<'TKey,'TValue> =
  new : unit -> Dictionary<'TKey, 'TValue> + 5 overloads
  member Add : key:'TKey * value:'TValue -> unit
  member Clear : unit -> unit
  member Comparer : IEqualityComparer<'TKey>
  member ContainsKey : key:'TKey -> bool
  member ContainsValue : value:'TValue -> bool
  member Count : int
  member GetEnumerator : unit -> Enumerator<'TKey, 'TValue>
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member Item : 'TKey -> 'TValue with get, set
  ...
  nested type Enumerator
  nested type KeyCollection
  nested type ValueCollection

Full name: System.Collections.Generic.Dictionary<_,_>

--------------------
Collections.Generic.Dictionary() : unit
Collections.Generic.Dictionary(capacity: int) : unit
Collections.Generic.Dictionary(comparer: Collections.Generic.IEqualityComparer<'TKey>) : unit
Collections.Generic.Dictionary(dictionary: Collections.Generic.IDictionary<'TKey,'TValue>) : unit
Collections.Generic.Dictionary(capacity: int, comparer: Collections.Generic.IEqualityComparer<'TKey>) : unit
Collections.Generic.Dictionary(dictionary: Collections.Generic.IDictionary<'TKey,'TValue>, comparer: Collections.Generic.IEqualityComparer<'TKey>) : unit
type CRecord =
  {Position: int64;
   Data: obj;}

Full name: Megaton.Engine.CRecord
CRecord.Position: int64
Multiple items
val int64 : value:'T -> int64 (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int64

--------------------
type int64 = Int64

Full name: Microsoft.FSharp.Core.int64

--------------------
type int64<'Measure> = int64

Full name: Microsoft.FSharp.Core.int64<_>
Multiple items
CRecord.Data: obj

--------------------
namespace System.Data

--------------------
namespace Microsoft.FSharp.Data
Multiple items
type Cluster =
  new : path:string * name:string -> Cluster
  member All : unit -> 'b list
  member ClusterDelete : unit -> unit
  member ClusterDetach : unit -> unit
  member ClusterMove : n:string -> unit
  member Count : unit -> int
  member Delete : k:string -> unit
  member Dir : unit -> 'c list
  member Empty : unit -> int
  member Get : k:string -> 'f option
  ...

Full name: Megaton.Engine.Cluster

--------------------
new : path:string * name:string -> Cluster
val path : string
val name : string
val mutable c_path : string
type Path =
  static val DirectorySeparatorChar : char
  static val AltDirectorySeparatorChar : char
  static val VolumeSeparatorChar : char
  static val InvalidPathChars : char[]
  static val PathSeparator : char
  static member ChangeExtension : path:string * extension:string -> string
  static member Combine : [<ParamArray>] paths:string[] -> string + 3 overloads
  static member GetDirectoryName : path:string -> string
  static member GetExtension : path:string -> string
  static member GetFileName : path:string -> string
  ...

Full name: System.IO.Path
Path.Combine([<ParamArray>] paths: string []) : string
Path.Combine(path1: string, path2: string) : string
Path.Combine(path1: string, path2: string, path3: string) : string
Path.Combine(path1: string, path2: string, path3: string, path4: string) : string
val records : Collections.Generic.Dictionary<string,CRecord>
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
val merge_lock : ReaderWriterLockSlim
Multiple items
type ReaderWriterLockSlim =
  new : unit -> ReaderWriterLockSlim + 1 overload
  member CurrentReadCount : int
  member Dispose : unit -> unit
  member EnterReadLock : unit -> unit
  member EnterUpgradeableReadLock : unit -> unit
  member EnterWriteLock : unit -> unit
  member ExitReadLock : unit -> unit
  member ExitUpgradeableReadLock : unit -> unit
  member ExitWriteLock : unit -> unit
  member IsReadLockHeld : bool
  ...

Full name: System.Threading.ReaderWriterLockSlim

--------------------
ReaderWriterLockSlim() : unit
ReaderWriterLockSlim(recursionPolicy: LockRecursionPolicy) : unit
val write_lock : Object
type obj = Object

Full name: Microsoft.FSharp.Core.obj
val mutable c_st : Stream
type Stream =
  inherit MarshalByRefObject
  member BeginRead : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member BeginWrite : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
  member CanRead : bool
  member CanSeek : bool
  member CanTimeout : bool
  member CanWrite : bool
  member Close : unit -> unit
  member CopyTo : destination:Stream -> unit + 1 overload
  member Dispose : unit -> unit
  member EndRead : asyncResult:IAsyncResult -> int
  ...

Full name: System.IO.Stream
val mutable c_bw : BinaryWriter
Multiple items
type BinaryWriter =
  new : output:Stream -> BinaryWriter + 1 overload
  member BaseStream : Stream
  member Close : unit -> unit
  member Dispose : unit -> unit
  member Flush : unit -> unit
  member Seek : offset:int * origin:SeekOrigin -> int64
  member Write : value:bool -> unit + 17 overloads
  static val Null : BinaryWriter

Full name: System.IO.BinaryWriter

--------------------
BinaryWriter(output: Stream) : unit
BinaryWriter(output: Stream, encoding: Text.Encoding) : unit
val mutable c_w : obj
val mutable c_id : byte []
Multiple items
type Guid =
  struct
    new : b:byte[] -> Guid + 4 overloads
    member CompareTo : value:obj -> int + 1 overload
    member Equals : o:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member ToByteArray : unit -> byte[]
    member ToString : unit -> string + 2 overloads
    static val Empty : Guid
    static member NewGuid : unit -> Guid
    static member Parse : input:string -> Guid
    static member ParseExact : input:string * format:string -> Guid
    ...
  end

Full name: System.Guid

--------------------
Guid()
Guid(b: byte []) : unit
Guid(g: string) : unit
Guid(a: int, b: int16, c: int16, d: byte []) : unit
Guid(a: uint32, b: uint16, c: uint16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
Guid(a: int, b: int16, c: int16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : unit
Guid.NewGuid() : Guid
val c_read : ((unit -> 'a) -> 'a)
val fn : (unit -> 'a)
ReaderWriterLockSlim.EnterReadLock() : unit
ReaderWriterLockSlim.ExitReadLock() : unit
val c_write : ((unit -> 'a) -> ('a -> 'b) -> 'b)
val commit : (unit -> 'a)
val merge : ('a -> 'b)
val lock : lockObject:'Lock -> action:(unit -> 'T) -> 'T (requires reference type)

Full name: Microsoft.FSharp.Core.Operators.lock
val pos : int64
property Stream.Position: int64
val res : 'a
BinaryWriter.Write(value: string) : unit
   (+0 other overloads)
BinaryWriter.Write(value: float32) : unit
   (+0 other overloads)
BinaryWriter.Write(value: uint64) : unit
   (+0 other overloads)
BinaryWriter.Write(value: int64) : unit
   (+0 other overloads)
BinaryWriter.Write(value: uint32) : unit
   (+0 other overloads)
BinaryWriter.Write(value: int) : unit
   (+0 other overloads)
BinaryWriter.Write(value: uint16) : unit
   (+0 other overloads)
BinaryWriter.Write(value: int16) : unit
   (+0 other overloads)
BinaryWriter.Write(value: decimal) : unit
   (+0 other overloads)
BinaryWriter.Write(value: float) : unit
   (+0 other overloads)
BinaryWriter.Flush() : unit
ReaderWriterLockSlim.EnterWriteLock() : unit
ReaderWriterLockSlim.ExitWriteLock() : unit
val create : (unit -> unit)
type File =
  static member AppendAllLines : path:string * contents:IEnumerable<string> -> unit + 1 overload
  static member AppendAllText : path:string * contents:string -> unit + 1 overload
  static member AppendText : path:string -> StreamWriter
  static member Copy : sourceFileName:string * destFileName:string -> unit + 1 overload
  static member Create : path:string -> FileStream + 3 overloads
  static member CreateText : path:string -> StreamWriter
  static member Decrypt : path:string -> unit
  static member Delete : path:string -> unit
  static member Encrypt : path:string -> unit
  static member Exists : path:string -> bool
  ...

Full name: System.IO.File
File.Open(path: string, mode: FileMode) : FileStream
File.Open(path: string, mode: FileMode, access: FileAccess) : FileStream
File.Open(path: string, mode: FileMode, access: FileAccess, share: FileShare) : FileStream
type FileMode =
  | CreateNew = 1
  | Create = 2
  | Open = 3
  | OpenOrCreate = 4
  | Truncate = 5
  | Append = 6

Full name: System.IO.FileMode
field FileMode.CreateNew = 1
type FileAccess =
  | Read = 1
  | Write = 2
  | ReadWrite = 3

Full name: System.IO.FileAccess
field FileAccess.ReadWrite = 3
type FileShare =
  | None = 0
  | Read = 1
  | Write = 2
  | ReadWrite = 3
  | Delete = 4
  | Inheritable = 16

Full name: System.IO.FileShare
field FileShare.Read = 1
val load : (unit -> unit)
val br : BinaryReader
Multiple items
type BinaryReader =
  new : input:Stream -> BinaryReader + 1 overload
  member BaseStream : Stream
  member Close : unit -> unit
  member Dispose : unit -> unit
  member PeekChar : unit -> int
  member Read : unit -> int + 2 overloads
  member ReadBoolean : unit -> bool
  member ReadByte : unit -> byte
  member ReadBytes : count:int -> byte[]
  member ReadChar : unit -> char
  ...

Full name: System.IO.BinaryReader

--------------------
BinaryReader(input: Stream) : unit
BinaryReader(input: Stream, encoding: Text.Encoding) : unit
val sr : obj
val deld : Collections.Generic.List<string>
type ResizeArray<'T> = Collections.Generic.List<'T>

Full name: Microsoft.FSharp.Collections.ResizeArray<_>
val follow : (int64 -> 'g)
Stream.Seek(offset: int64, origin: SeekOrigin) : int64
type SeekOrigin =
  | Begin = 0
  | Current = 1
  | End = 2

Full name: System.IO.SeekOrigin
field SeekOrigin.Begin = 0
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
BinaryReader.ReadByte() : byte
val old_pos : int64
BinaryReader.ReadInt64() : int64
val data_pos : int64
val old : 'g
val ok : string
Collections.Generic.List.Add(item: string) : unit
val nk : obj
val failwith : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
property Stream.Length: int64
val len : int64
val mutable pos : int64
val k : string
val not : value:bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
Collections.Generic.Dictionary.ContainsKey(key: string) : bool
Collections.Generic.List.Contains(item: string) : bool
Collections.Generic.Dictionary.Add(key: string, value: CRecord) : unit
Multiple items
namespace System.Data

--------------------
namespace Microsoft.FSharp.Data
val old : obj
val nk : string
Stream.Close() : unit
field FileMode.Open = 3
field FileAccess.Write = 2
val recover : (unit -> 'a)
val reattach : (unit -> unit)
BinaryReader.ReadBytes(count: int) : byte []
val last : byte []
File.Exists(path: string) : bool
val self : Cluster
member Cluster.ClusterDetach : unit -> unit

Full name: Megaton.Engine.Cluster.ClusterDetach
member Cluster.ClusterDelete : unit -> unit

Full name: Megaton.Engine.Cluster.ClusterDelete
File.Delete(path: string) : unit
member Cluster.ClusterMove : n:string -> unit

Full name: Megaton.Engine.Cluster.ClusterMove
val n : string
val new_path : string
File.Move(sourceFileName: string, destFileName: string) : unit
field FileMode.Append = 6
member Cluster.Get : k:string -> 'f option

Full name: Megaton.Engine.Cluster.Get
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
Multiple items
member Cluster.Set : r:CRecord -> unit

Full name: Megaton.Engine.Cluster.Set

--------------------
module Set

from Microsoft.FSharp.Collections

--------------------
type Set<'T (requires comparison)> =
  interface IComparable
  interface IEnumerable
  interface IEnumerable<'T>
  interface ICollection<'T>
  new : elements:seq<'T> -> Set<'T>
  member Add : value:'T -> Set<'T>
  member Contains : value:'T -> bool
  override Equals : obj -> bool
  member IsProperSubsetOf : otherSet:Set<'T> -> bool
  member IsProperSupersetOf : otherSet:Set<'T> -> bool
  ...

Full name: Microsoft.FSharp.Collections.Set<_>

--------------------
new : elements:seq<'T> -> Set<'T>
val r : CRecord
val cr : CRecord
CRecord.Data: obj
member Cluster.Has : k:string -> bool

Full name: Megaton.Engine.Cluster.Has
member Cluster.Head : k:string -> 'e option

Full name: Megaton.Engine.Cluster.Head
type Type =
  inherit MemberInfo
  member Assembly : Assembly
  member AssemblyQualifiedName : string
  member Attributes : TypeAttributes
  member BaseType : Type
  member ContainsGenericParameters : bool
  member DeclaringMethod : MethodBase
  member DeclaringType : Type
  member Equals : o:obj -> bool + 1 overload
  member FindInterfaces : filter:TypeFilter * filterCriteria:obj -> Type[]
  member FindMembers : memberType:MemberTypes * bindingAttr:BindingFlags * filter:MemberFilter * filterCriteria:obj -> MemberInfo[]
  ...

Full name: System.Type
member Cluster.Count : unit -> int

Full name: Megaton.Engine.Cluster.Count
property Collections.Generic.Dictionary.Count: int
member Cluster.Delete : k:string -> unit

Full name: Megaton.Engine.Cluster.Delete
Collections.Generic.Dictionary.Remove(key: string) : bool
member Cluster.Update : r:'d -> unit

Full name: Megaton.Engine.Cluster.Update
val r : 'd
member Cluster.Move : k:string -> nk:string -> unit

Full name: Megaton.Engine.Cluster.Move
val nr : CRecord
member Cluster.Dir : unit -> 'c list

Full name: Megaton.Engine.Cluster.Dir
val r : Collections.Generic.KeyValuePair<string,CRecord>
property Collections.Generic.KeyValuePair.Key: string
property Collections.Generic.KeyValuePair.Value: CRecord
member Cluster.All : unit -> 'b list

Full name: Megaton.Engine.Cluster.All
member Cluster.Many : ks:string list -> 'a list

Full name: Megaton.Engine.Cluster.Many
val ks : string list
val vks : string list
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val filter : predicate:('T -> bool) -> list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.filter
member Cluster.SetMany : rs:seq<CRecord> -> unit

Full name: Megaton.Engine.Cluster.SetMany
val rs : seq<CRecord>
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
val crs : (string * CRecord) list
member Cluster.Empty : unit -> int

Full name: Megaton.Engine.Cluster.Empty
val c : int
Collections.Generic.Dictionary.Clear() : unit
Raw view Test code New version

More information

Link:http://fssnip.net/T
Posted:15 years ago
Author:
Tags: