text stringlengths 0 601k |
|---|
let items_per_dom = num_items / 2 |
let ( ) = Printf . printf " items_per_domain = % d \ n " %! @@ items_per_dom |
module M = struct let num_domains = 3 let is_affine = false end |
module S = Sched_ws . Make ( M ) |
module Reagents = Reagents . Make ( S ) |
module Benchmark = struct let get_mean_sd l = let get_mean l = ( List . fold_right ( fun a v -> a . + v ) l 0 . ) . / ( float_of_int @@ List . length l ) in let mean = get_mean l in let sd = get_mean @@ List . map ( fun v -> abs_float ( v . - mean ) ** 2 . ) l in ( mean , sd ) let benchmark f n = let rec run acc = func... |
module type STACK = sig type t val create : unit -> t * t val push : t -> int -> unit val pop : t -> t -> int * int end |
module Test ( Stack : STACK ) = struct let run items_per_domain = let q1 , q2 = Stack . create ( ) in let b = CDL . create 3 in let rec produce id q = function | 0 -> ( ) | i -> let v = Random . int 1000 in Stack . push q v ; produce id q ( i - 1 ) in let rec consume = function | 0 -> ( ) | i -> let _ = Stack . pop q1 ... |
module M1 : STACK = struct type t = int T . t let create ( ) = ( T . create ( ) , T . create ( ) ) let push s v = Reagents . run ( T . push s ) v let pop s1 s2 = let a = Reagents . run ( T . pop s1 ) ( ) in let b = Reagents . run ( T . pop s2 ) ( ) in ( a , b ) end |
module M2 : STACK = struct type t = int T . t let create ( ) = ( T . create ( ) , T . create ( ) ) let push s v = Reagents . run ( T . push s ) v let pop s1 s2 = Reagents . run ( T . pop s1 <*> T . pop s2 ) ( ) end |
module M3 : STACK = struct type t = int T . t let create ( ) = ( T . create ( ) , T . create ( ) ) let push s v = Reagents . run ( T . push s ) v let pop s1 s2 = Reagents . run ( ( T . pop s1 >>> lift ( fun _ -> ( ) ) >>> T . pop s2 >>> lift ( fun _ -> ( 0 , 0 ) ) ) <+> ( T . pop s2 >>> lift ( fun _ -> ( ) ) >>> T . po... |
let main ( ) = let module M = Test ( M2 ) in let ( m , sd ) = Benchmark . benchmark ( fun ( ) -> M . run items_per_dom ) 5 in printf " <*>: mean = % f , sd = % f tp =% f \ n " %! m sd ( float_of_int num_items . / m ) ; Gc . full_major ( ) ; let module M = Test ( M3 ) in let ( m , sd ) = Benchmark . benchmark ( fun ( ) ... |
let ( ) = S . run main |
let option lab = Option . value_map ~ default ( : Or_error . error_string lab ) lab ~ f ( : fun x -> Ok x ) x |
let yield_result ( ) = Deferred . map ( Scheduler . yield ( ) ) ~ f : Result . return |
module T = struct module Scan_state = Transaction_snark_scan_state module Pre_diff_info = Pre_diff_info module Staged_ledger_error = struct type t = | Non_zero_fee_excess of Scan_state . Space_partition . t * Transaction . t With_status . t list | Invalid_proofs of ( Ledger_proof . t * Transaction_snark . Statement . t... |
module At_most_two = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type ' a t = Zero | One of ' a option | Two of ( ' a * ' a option ) option option [ @@ deriving compare , sexp , yojson ] yojson end end ] end type ' a t = ' a Stable . Latest . t... |
module At_most_one = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type ' a t = Zero | One of ' a option [ @@ deriving compare , sexp , yojson ] yojson end end ] end type ' a t = ' a Stable . Latest . t = Zero | One of ' a option [ @@ deriving co... |
module Ft = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type t = Coinbase . Fee_transfer . Stable . V1 . t [ @@ deriving compare , sexp , yojson ] yojson let to_latest = Fn . id end end ] end type t = Stable . Latest . t [ @@ deriving compare ,... |
module Pre_diff_two = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type ( ' a , ' b ) ' b t = { completed_works : ' a list ; commands : ' b list ; coinbase : Ft . Stable . V1 . t At_most_two . Stable . V1 . t } [ @@ deriving compare , sexp , yoj... |
module Pre_diff_one = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type ( ' a , ' b ) ' b t = { completed_works : ' a list ; commands : ' b list ; coinbase : Ft . Stable . V1 . t At_most_one . Stable . V1 . t } [ @@ deriving compare , sexp , yoj... |
module Pre_diff_with_at_most_two_coinbase = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type t = ( Transaction_snark_work . Stable . V2 . t , User_command . Stable . V2 . t With_status . Stable . V2 . t ) Pre_diff_two . Stable . V2 . t [ @@ der... |
module Pre_diff_with_at_most_one_coinbase = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type t = ( Transaction_snark_work . Stable . V2 . t , User_command . Stable . V2 . t With_status . Stable . V2 . t ) Pre_diff_one . Stable . V2 . t [ @@ der... |
module Diff = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type t = Pre_diff_with_at_most_two_coinbase . Stable . V2 . t * Pre_diff_with_at_most_one_coinbase . Stable . V2 . t option [ @@ deriving compare , sexp , yojson ] yojson let to_latest =... |
module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type t = { diff : Diff . Stable . V2 . t } [ @@ deriving compare , sexp , yojson ] yojson let to_latest = Fn . id end end ] end |
type t = Stable . Latest . t = { diff : Diff . t } |
module With_valid_signatures_and_proofs = struct type pre_diff_with_at_most_two_coinbase = ( Transaction_snark_work . Checked . t , User_command . Valid . t With_status . t ) Pre_diff_two . t [ @@ deriving compare , sexp , to_yojson ] to_yojson type pre_diff_with_at_most_one_coinbase = ( Transaction_snark_work . Checke... |
let forget_cw cw_list = List . map ~ f : Transaction_snark_work . forget cw_list |
let coinbase_amount ( ~ constraint_constants : Genesis_constants . Constraint_constants . t ) t ~ supercharge_coinbase = if supercharge_coinbase then Currency . Amount . scale constraint_constants . coinbase_amount constraint_constants . supercharged_coinbase_factor else Some constraint_constants . coinbase_amount |
let coinbase ( ~ constraint_constants : Genesis_constants . Constraint_constants . t ) t ~ supercharge_coinbase t = let first_pre_diff , second_pre_diff_opt = t . diff in let coinbase_amount = coinbase_amount ~ constraint_constants ~ supercharge_coinbase in match ( first_pre_diff . coinbase , Option . value_map second_... |
module With_valid_signatures = struct type pre_diff_with_at_most_two_coinbase = ( Transaction_snark_work . t , User_command . Valid . t With_status . t ) Pre_diff_two . t [ @@ deriving compare , sexp , to_yojson ] to_yojson type pre_diff_with_at_most_one_coinbase = ( Transaction_snark_work . t , User_command . Valid . ... |
let validate_commands ( t : t ) t ( ~ check : User_command . t list -> ( User_command . Valid . t list , ' e ) ' e Result . t Async . Deferred . Or_error . t ) : ( With_valid_signatures . t , ' e ) ' e Result . t Async . Deferred . Or_error . t = let map t ~ f = Async . Deferred . Or_error . map t ~ f ( : Result . map ... |
let forget_proof_checks ( d : With_valid_signatures_and_proofs . t ) t : With_valid_signatures . t = let d1 = fst d . diff in let p1 : With_valid_signatures . pre_diff_with_at_most_two_coinbase = { completed_works = forget_cw d1 . completed_works ; commands = d1 . commands ; coinbase = d1 . coinbase } in let p2 = Optio... |
let forget_pre_diff_with_at_most_two ( pre_diff : With_valid_signatures_and_proofs . pre_diff_with_at_most_two_coinbase ) : Pre_diff_with_at_most_two_coinbase . t = { completed_works = forget_cw pre_diff . completed_works ; commands = ( pre_diff . commands :> User_command . t With_status . t list ) list ; coinbase = pr... |
let forget_pre_diff_with_at_most_one ( pre_diff : With_valid_signatures_and_proofs . pre_diff_with_at_most_one_coinbase ) = { Pre_diff_one . completed_works = forget_cw pre_diff . completed_works ; commands = ( pre_diff . commands :> User_command . t With_status . t list ) list ; coinbase = pre_diff . coinbase } |
let forget ( t : With_valid_signatures_and_proofs . t ) t = { diff = ( forget_pre_diff_with_at_most_two ( fst t . diff ) diff , Option . map ( snd t . diff ) diff ~ f : forget_pre_diff_with_at_most_one ) } |
let commands ( t : t ) t = ( fst t . diff ) diff . commands @ Option . value_map ( snd t . diff ) diff ~ default [ ] : ~ f ( : fun d -> d . commands ) commands |
let completed_works ( t : t ) t = ( fst t . diff ) diff . completed_works @ Option . value_map ( snd t . diff ) diff ~ default [ ] : ~ f ( : fun d -> d . completed_works ) completed_works |
let net_return ( ~ constraint_constants : Genesis_constants . Constraint_constants . t ) t ~ supercharge_coinbase ( t : t ) t = let open Currency in let open Option . Let_syntax in let % bind coinbase = coinbase ~ constraint_constants ~ supercharge_coinbase t in let % bind total_reward = List . fold ~ init ( : Some ( A... |
let empty_diff : t = { diff = ( { completed_works = [ ] ; commands = [ ] ; coinbase = At_most_two . Zero } , None ) } |
module Aux_hash = struct let length_in_bits = 256 let length_in_bytes = length_in_bits / 8 [ %% versioned module Stable = struct module V1 = struct type t = string [ @@ deriving sexp , equal , compare , hash ] hash let to_latest = Fn . id module Base58_check = Base58_check . Make ( struct let description = " Aux hash "... |
module Pending_coinbase_aux = struct let length_in_bits = 256 let length_in_bytes = length_in_bits / 8 [ %% versioned module Stable = struct module V1 = struct type t = string [ @@ deriving sexp , equal , compare , hash ] hash let to_latest = Fn . id module Base58_check = Base58_check . Make ( struct let description = ... |
module Non_snark = struct [ %% versioned module Stable = struct module V1 = struct type t = { ledger_hash : Ledger_hash . Stable . V1 . t ; aux_hash : Aux_hash . Stable . V1 . t ; pending_coinbase_aux : Pending_coinbase_aux . Stable . V1 . t } [ @@ deriving sexp , equal , compare , hash , yojson ] yojson let to_latest ... |
module Poly = struct [ %% versioned module Stable = struct module V1 = struct type ( ' non_snark , ' pending_coinbase_hash ) ' pending_coinbase_hash t = { non_snark : ' non_snark ; pending_coinbase_hash : ' pending_coinbase_hash } [ @@ deriving sexp , equal , compare , hash , yojson , hlist ] hlist end end ] end end [ ... |
module Stable = struct module V1 = struct type t = ( Non_snark . Stable . V1 . t , Pending_coinbase . Hash_versioned . Stable . V1 . t ) Poly . Stable . V1 . t [ @@ deriving sexp , equal , compare , hash , yojson ] yojson let to_latest = Fn . id end end ] end |
type ( ' a , ' b ) ' b t_ = ( ' a , ' b ) ' b Poly . t |
type value = t [ @@ deriving sexp , equal , compare , hash ] hash |
type var = ( Non_snark . var , Pending_coinbase . Hash . var ) var t_ |
let ledger_hash ( { non_snark ; _ } : t ) t = Non_snark . ledger_hash non_snark |
let aux_hash ( { non_snark ; _ } : t ) t = Non_snark . aux_hash non_snark |
let pending_coinbase_hash ( { pending_coinbase_hash ; _ } : t ) t = pending_coinbase_hash |
let pending_coinbase_hash_var ( { pending_coinbase_hash ; _ } : var ) var = pending_coinbase_hash |
let of_aux_ledger_and_coinbase_hash aux_hash ledger_hash pending_coinbase : t = { non_snark = Non_snark . of_ledger_aux_coinbase_hash aux_hash ledger_hash ( Pending_coinbase . hash_extra pending_coinbase ) pending_coinbase ; pending_coinbase_hash = Pending_coinbase . merkle_root pending_coinbase } |
let genesis ( ~ constraint_constants : Genesis_constants . Constraint_constants . t ) t ~ genesis_ledger_hash : t = let pending_coinbase = Pending_coinbase . create ~ depth : constraint_constants . pending_coinbase_depth ( ) |> Or_error . ok_exn in { non_snark = Non_snark . genesis ~ genesis_ledger_hash ; pending_coinb... |
let var_of_t ( { pending_coinbase_hash ; non_snark } : t ) t : var = let non_snark = Non_snark . var_of_t non_snark in let pending_coinbase_hash = Pending_coinbase . Hash . var_of_t pending_coinbase_hash in { non_snark ; pending_coinbase_hash } |
let to_input ( { non_snark ; pending_coinbase_hash } : t ) t = Random_oracle . Input . Chunked ( . append ( Non_snark . to_input non_snark ) non_snark ( field ( pending_coinbase_hash :> Field . t ) t ) t ) t |
let var_to_input ( { non_snark ; pending_coinbase_hash } : var ) var = Random_oracle . Input . Chunked ( . append ( Non_snark . var_to_input non_snark ) non_snark ( field ( Pending_coinbase . Hash . var_to_hash_packed pending_coinbase_hash ) pending_coinbase_hash ) pending_coinbase_hash ) pending_coinbase_hash |
let data_spec = let open Data_spec in [ Non_snark . typ ; Pending_coinbase . Hash . typ ] |
let typ : ( var , t ) t Typ . t = Typ . of_hlistable data_spec ~ var_to_hlist : Poly . to_hlist ~ var_of_hlist : Poly . of_hlist ~ value_to_hlist : Poly . to_hlist ~ value_of_hlist : Poly . of_hlist |
module Selected_distribution_for_cycle = struct module Cache_client = struct type cached_value = ( Signature . Public_key_hash . t * Tez_repr . t ) list let namespace = Cache_repr . create_namespace " stake_distribution " let cache_index = 1 let value_of_identifier ctxt identifier = let cycle = Cycle_repr . of_string_e... |
module Delegate_sampler_state = struct module Cache_client = struct type cached_value = ( Signature . Public_key . t * Signature . Public_key_hash . t ) Sampler . t let namespace = Cache_repr . create_namespace " sampler_state " let cache_index = 2 let value_of_identifier ctxt identifier = let cycle = Cycle_repr . of_s... |
let ensure_stake_inited ctxt delegate = Storage . Stake . Staking_balance . mem ctxt delegate >>= function | true -> return ctxt | false -> Frozen_deposits_storage . init ctxt delegate >>=? fun ctxt -> Storage . Stake . Staking_balance . init ctxt delegate Tez_repr . zero |
let remove_stake ctxt delegate amount = ensure_stake_inited ctxt delegate >>=? fun ctxt -> let tokens_per_roll = Constants_storage . tokens_per_roll ctxt in get_staking_balance ctxt delegate >>=? fun staking_balance_before -> Tez_repr . ( staking_balance_before -? amount ) >>?= fun staking_balance -> Storage . Stake . ... |
let add_stake ctxt delegate amount = ensure_stake_inited ctxt delegate >>=? fun ctxt -> let tokens_per_roll = Constants_storage . tokens_per_roll ctxt in get_staking_balance ctxt delegate >>=? fun staking_balance_before -> Tez_repr . ( amount +? staking_balance_before ) >>?= fun staking_balance -> Storage . Stake . Sta... |
let deactivate_only_call_from_delegate_storage ctxt delegate = Storage . Stake . Active_delegate_with_one_roll . remove ctxt delegate |
let activate_only_call_from_delegate_storage ctxt delegate = ensure_stake_inited ctxt delegate >>=? fun ctxt -> get_staking_balance ctxt delegate >>=? fun staking_balance -> let tokens_per_roll = Constants_storage . tokens_per_roll ctxt in if Tez_repr . ( staking_balance >= tokens_per_roll ) then Storage . Stake . Acti... |
let snapshot ctxt = Storage . Stake . Last_snapshot . get ctxt >>=? fun index -> Storage . Stake . Last_snapshot . update ctxt ( index + 1 ) >>=? fun ctxt -> Storage . Stake . Staking_balance . snapshot ctxt index >>=? fun ctxt -> Storage . Stake . Active_delegate_with_one_roll . snapshot ctxt index |
let select_distribution_for_cycle ctxt cycle pubkey = Storage . Stake . Last_snapshot . get ctxt >>=? fun max_index -> Storage . Seed . For_cycle . get ctxt cycle >>=? fun seed -> let rd = Seed_repr . initialize_new seed [ Bytes . of_string " stake_snapshot " ] in let seq = Seed_repr . sequence rd 0l in let selected_in... |
let clear_cycle ctxt cycle = Storage . Total_active_stake . remove_existing ctxt cycle >>=? fun ctxt -> Selected_distribution_for_cycle . remove_existing ctxt cycle >>=? fun ctxt -> Delegate_sampler_state . remove_existing ctxt cycle >>=? fun ctxt -> Storage . Seed . For_cycle . remove_existing ctxt cycle |
let init_first_cycles ctxt pubkey = let preserved = Constants_storage . preserved_cycles ctxt in List . fold_left_es ( fun ctxt c -> let cycle = Cycle_repr . of_int32_exn ( Int32 . of_int c ) in snapshot ctxt >>=? fun ctxt -> select_distribution_for_cycle ctxt cycle pubkey ) ctxt ( 0 --> preserved ) |
let fold ctxt ~ f ~ order init = Storage . Stake . Active_delegate_with_one_roll . fold ctxt ~ order ~ init ( : Ok init ) ~ f ( : fun delegate ( ) acc -> acc >>?= fun acc -> get_staking_balance ctxt delegate >>=? fun stake -> f ( delegate , stake ) acc ) |
let select_new_distribution_at_cycle_end ctxt ~ new_cycle = let preserved = Constants_storage . preserved_cycles ctxt in let for_cycle = Cycle_repr . add new_cycle preserved in select_distribution_for_cycle ctxt for_cycle |
let clear_at_cycle_end ctxt ~ new_cycle = let max_slashing_period = Constants_storage . max_slashing_period ctxt in match Cycle_repr . sub new_cycle max_slashing_period with | None -> return ctxt | Some cycle_to_clear -> clear_cycle ctxt cycle_to_clear |
let get ctxt delegate = Storage . Stake . Active_delegate_with_one_roll . mem ctxt delegate >>= function | true -> get_staking_balance ctxt delegate | false -> return Tez_repr . zero |
let prepare_stake_distribution ctxt = let level = Level_storage . current ctxt in Selected_distribution_for_cycle . get ctxt level . cycle >>=? fun stakes -> let stake_distribution = List . fold_left ( fun map ( pkh , stake ) -> Signature . Public_key_hash . Map . add pkh stake map ) Signature . Public_key_hash . Map .... |
module Context = struct type ( ' message , ' pk ) ' pk t = { message : ' message ; public_key : ' pk } [ @@ deriving sexp , hlist ] hlist end |
module Evaluation = struct module Discrete_log_equality = struct module Poly = struct [ %% versioned module Stable = struct module V1 = struct type ' scalar t = { c : ' scalar ; s : ' scalar } [ @@ deriving sexp ] sexp let to_latest = Fn . id end end ] end end end module Poly = struct [ %% versioned module Stable = str... |
module Make ( Impl : Snarky_backendless . Snark_intf . S ) S ( Scalar : sig type t [ @@ deriving equal , sexp ] sexp val random : unit -> t val add : t -> t -> t val mul : t -> t -> t type var val typ : ( var , t ) t Impl . Typ . t module Checked : sig open Impl val to_bits : var -> Boolean . var Bitstring_lib . Bitstr... |
module Bigint_scalar ( Impl : Snarky_backendless . Snark_intf . S ) S ( M : sig val modulus : Bigint . t val random : unit -> Bigint . t end ) end = struct let pack bs = let pack_char bs = Char . of_int_exn ( List . foldi bs ~ init : 0 ~ f ( : fun i acc b -> if b then acc lor ( 1 lsl i ) i else acc ) ) in String . of_c... |
( module struct module Impl = Snark_params . Tick module Other_impl = Snark_params . Tock module B = Bigint module Scalar = struct include ( Snark_params . Tick . Inner_curve . Scalar : module type of Snark_params . Tick . Inner_curve . Scalar with type t = Snark_params . Tick . Inner_curve . Scalar . t and type var :=... |
let field_tokens param_val = let delim_re = Str . regexp ( Str . quote param_val ) in ( fun tuple -> Str . split delim_re tuple ) |
let offset_tokens param_val = let offsets = List . map int_of_string ( Str . split ( Str . regexp " , " ) param_val ) in if List . length offsets = 0 then failwith " Offset tokenizer : no offsets specified " ! else let aux tuple ( prev_off , acc ) off = try ( off , acc [ @ String . sub tuple prev_off ( off - prev_off )... |
let tokenizers : ( string * ( string -> string -> string list ) ) list = [ ( " delimiter " , field_tokens ) ; ( " offsets " , offset_tokens ) ] |
let preproject param_val = let field_ids = List . map int_of_string ( Str . split ( Str . regexp " , " ) param_val ) in ( fun fields -> List . map ( List . nth fields ) field_ids ) |
let change_case param_val = match param_val with | " upper " -> ( fun fields -> List . map String . uppercase_ascii fields ) | " lower " -> ( fun fields -> List . map String . lowercase_ascii fields ) | _ -> ( fun fields -> fields ) |
let substring param_val = let split_re = Str . regexp " , " in let spec_re = Str . regexp " [ 0 - 9 ] , [ * 0 - 9 ] , [ * 0 - 9 ] " * in let pos = ref 0 in let spec = ref [ ] in while Str . string_match spec_re param_val ! pos do let triple = Str . matched_string param_val in let t_fields = List . map int_of_string ( S... |
let skiplines param_val = let num = ref ( int_of_string param_val ) in ( fun fields -> if ! num > 0 then ( num := ! num - 1 ; raise AbortEventConstruction ) else fields ) |
let trimwhitespace param_val = ( fun fields -> List . map ( Str . global_replace ( Str . regexp " ^ ( . [ *\\*^ ] ) \\ " ) *$ " \\ 1 " ) fields ) |
let preprocessors : ( string * ( string -> string list -> string list ) ) list = [ ( " project " , preproject ) ; ( " case " , change_case ) ; ( " substring " , substring ) ; ( " skiplines " , skiplines ) ; ( " trimwhitespace " , trimwhitespace ) ] |
let build_tuple ( reln , relv , _ ) param_val support_sch = let types = ( List . map Type . string_of_type support_sch ) @ ( Str . split ( Str . regexp " , " ) param_val ) in let full_sch = ( List . map ( fun x -> ( " tmp " , x ) ) support_sch ) @ relv in let assert_type vn vt scht cmpt = if vt <> cmpt then failwith ( ... |
let build_rel_tuple ( reln , relv , relt ) support_sch = let synthesized_schema = ListExtras . string_of_list ~ sep " , " : ( fun ( _ , t ) -> Type . string_of_type t ) relv in build_tuple ( reln , relv , relt ) synthesized_schema support_sch |
let constructors rel_sch : ( string * ( string -> Type . type_t list -> string list -> const_t list ) ) list = [ ( " schema " , ( build_tuple rel_sch ) ) ] |
let postproject param_val = let field_ids = List . map int_of_string ( Str . split ( Str . regexp " , " ) param_val ) in ( fun fields -> List . map ( List . nth fields ) field_ids ) |
let postprocessors : ( string * ( string -> const_t list -> const_t list ) ) list = [ ( " postproject " , postproject ) ] |
let constant_event param_val = match param_val with | " insert " -> ( fun fields -> [ ( 0 , AInsert , fields ) ] ) | " delete " -> ( fun fields -> [ ( 0 , ADelete , fields ) ] ) | _ -> failwith ( " invalid event type " ^ param_val ) |
let parametrized_event param_val = let rules = List . map ( fun rule -> match ( Str . split ( Str . regexp " " ) : rule ) with | [ k ; " insert " ] -> ( CFloat ( float ( Hashtbl . hash k ) ) , AInsert ) | [ k ; " delete " ] -> ( CFloat ( float ( Hashtbl . hash k ) ) , ADelete ) | _ -> failwith ( " invalid event type fi... |
let event_constructors : ( string * ( ( string -> const_t list -> ( int * adaptor_event_t * const_t list ) list ) * ( string -> Type . type_t list ) ) ) list = [ ( " eventtype " , ( constant_event , ( function _ -> [ ] ) ) ) ; ( " triggers " , ( parametrized_event , ( function _ -> [ TInt ; TInt ] ) ) ) ; ( " deletions... |
let standard_generator rel_sch params = let match_keys l = List . map ( fun ( k , v ) -> ( List . assoc k l ) v ) ( List . filter ( fun ( k , v ) -> List . mem_assoc k l ) params ) in let match_unique_default l fn_class default = let m = match_keys l in match m with | [ f ] -> f | [ ] -> default | _ -> failwith ( " Mul... |
let csv_params ( ? event = " none " ) delim schema = let schema_val = if schema = " " then " float " else schema in ( " csv " , [ ( " delimiter " , delim ) ; ( " schema " , schema_val ) ] @ ( match event with " " -> [ " eventtype " , " insert " ] | " none " -> [ ] | _ -> [ " eventtype " , event ] ) ) |
let insert_csv delim = csv_params ~ event " : insert " delim " " |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.