MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

plugins/autoclean.c:864–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862};
863
864int main(int argc, char *argv[])
865{
866 setup_locale();
867
868 timer_cinfo = new_clean_info(NULL, NULL);
869 /* Default is 30 days for network events */
870 timer_cinfo->per_subsystem[NETWORKEVENTS].variants[SUCCESS].age
871 = 30 * 24 * 3600;
872 plugin_main(argv, init, NULL, PLUGIN_STATIC, true, NULL,
873 commands, ARRAY_SIZE(commands),
874 NULL, 0, NULL, 0, NULL, 0,
875 plugin_option_dynamic("autoclean-cycle",
876 "int",
877 "Perform cleanup every"
878 " given seconds",
879 cycle_seconds_option, u64_jsonfmt,
880 &cycle_seconds),
881 plugin_option_dynamic("autoclean-succeededforwards-age",
882 "int",
883 "How old do successful forwards have to be before deletion (0 = never)",
884 u64_option, u64_jsonfmt_unless_zero,
885 &timer_cinfo->per_subsystem[FORWARDS].variants[SUCCESS].age),
886 plugin_option_dynamic("autoclean-failedforwards-age",
887 "int",
888 "How old do failed forwards have to be before deletion (0 = never)",
889 u64_option, u64_jsonfmt_unless_zero,
890 &timer_cinfo->per_subsystem[FORWARDS].variants[FAILURE].age),
891 plugin_option_dynamic("autoclean-succeededpays-age",
892 "int",
893 "How old do successful pays have to be before deletion (0 = never)",
894 u64_option, u64_jsonfmt_unless_zero,
895 &timer_cinfo->per_subsystem[PAYS].variants[SUCCESS].age),
896 plugin_option_dynamic("autoclean-failedpays-age",
897 "int",
898 "How old do failed pays have to be before deletion (0 = never)",
899 u64_option, u64_jsonfmt_unless_zero,
900 &timer_cinfo->per_subsystem[PAYS].variants[FAILURE].age),
901 plugin_option_dynamic("autoclean-paidinvoices-age",
902 "int",
903 "How old do paid invoices have to be before deletion (0 = never)",
904 u64_option, u64_jsonfmt_unless_zero,
905 &timer_cinfo->per_subsystem[INVOICES].variants[SUCCESS].age),
906 plugin_option_dynamic("autoclean-expiredinvoices-age",
907 "int",
908 "How old do expired invoices have to be before deletion (0 = never)",
909 u64_option, u64_jsonfmt_unless_zero,
910 &timer_cinfo->per_subsystem[INVOICES].variants[FAILURE].age),
911 plugin_option_dynamic("autoclean-networkevents-age",
912 "int",
913 "How old do networkevents have to be before deletion (0 = never)",
914 u64_option, u64_jsonfmt_unless_zero,
915 &timer_cinfo->per_subsystem[NETWORKEVENTS].variants[SUCCESS].age),
916 plugin_option_dev_dynamic("dev-autoclean-max-batch",
917 "int",
918 "Maximum cleans to do at a time",
919 u64_option, u64_jsonfmt,
920 &max_entries_per_call),
921 NULL);

Callers

nothing calls this directly

Calls 3

setup_localeFunction · 0.85
new_clean_infoFunction · 0.85
plugin_mainFunction · 0.70

Tested by

no test coverage detected