feeds.hrl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. -include("kvs.hrl").
  2. -record(feed, {?CONTAINER, aclver}).
  3. % id,
  4. % top,
  5. % aclver
  6. % entries_count=0
  7. %}).
  8. -record(entry, {?ITERATOR(feed),
  9. % id, % {entry_id, feed_id} we want to hold in key information about feed
  10. entry_id, % these fields
  11. % feed_id, % are for secondary indexes
  12. from, % author
  13. to,
  14. title,
  15. description,
  16. created, % time
  17. hidden,
  18. access,
  19. shared,
  20. starred,
  21. deleted,
  22. likes,
  23. likes_count,
  24. % comments,
  25. % comments_rear,
  26. % comments_count,
  27. media = [], %% for oembed
  28. etc, %% field to link additional info
  29. type = {user, normal}
  30. }).
  31. -record(id_seq, {thing, id}).
  32. -record(media, {
  33. id,
  34. title :: iolist(),
  35. width,
  36. height,
  37. html :: iolist(),
  38. url :: iolist(),
  39. version,
  40. thumbnail_url :: iolist(),
  41. type :: {atom(), atom() | string()},
  42. thumbnail_height}).
  43. -record(comment, {?ITERATOR(feed),
  44. % id, %% {comment_id, entry_id}
  45. comment_id, %% generowane przez id_seq
  46. entry_id, %% index
  47. content, %% text of comment
  48. author_id,
  49. creation_time,
  50. media = [], %% for oembed
  51. parent
  52. % comments,
  53. % comments_rear
  54. }).
  55. -record(entry_likes, {
  56. entry_id, % this is a general entry_id. Every same entry in different feeds has the same id
  57. one_like_head, % this is a head for linked list of {user, time} tupples
  58. total_count % it's easier to keep it than count
  59. }).
  60. -record(user_likes, {
  61. user_id,
  62. one_like_head,
  63. total_count
  64. }).
  65. -record(one_like, {
  66. id, % just a number
  67. user_id, % who likes
  68. entry_id, % what
  69. feed_id, % where
  70. created_time, % when
  71. next
  72. }).
  73. -record(hidden_feed, {id}).
  74. % Statistics. We have to keep count of user entries and comments.
  75. % Gathering it the old way will work very ineffective with more users to come.
  76. % And comments from user record are somehow always undefined. Either it fails, or it is used somewhere else
  77. -record(user_etries_count, {
  78. user_id, % user id
  79. entries = 0, % number of entries
  80. comments = 0 % number of comments
  81. }).