Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:59:38+00:00 2026-06-17T16:59:38+00:00

I have a few dynamic queue in my program which can add element at

  • 0

I have a few dynamic queue in my program which can add element at back or middle/remove from front during the processing and never stores the elements in memory once processing is done.However I want to log/serialize the dynamic state of the sequences including all removed elements for the introspection purpose.

e.g.

    struct element1{};
    struct element2{};
    std::deque<element1> v1;
    std::deque<element2> v2;

    if(some_cond1)
    {
       v1.push_back(element1{});
       //log v1.back()
       v1.push_back(element1{});
       //log v1.back()
    }
    if(some_cond2)
    {
       v2.push_back(element2{});
       //log v2.back()
       v2.push_back(element2{});
       //log v2.back()
    }
    if(another_cond)
    {
       v1.pop_front();//presently I am not logging removal of elements
       v2.pop_front();
    }
    if(a_third_cond)
    {
       v1.insert(some_pos,element1{});
       //log v1,some_pos
    }

I am looking at two alternative solution.

  • Is there some data format (say JSON) which allows array/object to be distributed over different location and referenced through some unique name/id as I do not preserve all the elements ready in memory to write to a file and log only part of the sequence as I go?

e.g.

   { 
     "v1" : [],
     "v2" : [],
     append("v1"):
     [
        "elem1_v1", "elem2_v1"
     ],
     append("v2"):
     [
        "elem1_v2", "elem2_v2"
     ],
     insert("v1",1):
     [
        "elem3_v1"
     ]
   }
  • Is it possible to write to multiple different locations to a single file so that each sequence tracks its own location and writes to that location so that end result is simple contiguous sequence description? (All i can think of something like a file backed SGI rope implementation)

In this case, the end result may look like,

   { 
     "v1" : ["elem1_v1","elem3_v1","elem2_v1"],
     "v2" : ["elem1_v2","elem2_v2"]
   }

Of course in a crude way , I can log all elements in a flat file, prefixing with some piece of information such as which sequence & where, and search them in whole file to reconstruct them back. However I am looking for a better robust & more structured alternative if available to deal with such problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:59:39+00:00Added an answer on June 17, 2026 at 4:59 pm

    Your best bet is sequential logging (with identifier) plus later reconstruction.

    The issue of random access logging is two-fold:

    • random writes are much slower than sequential writes on most disks
    • how much space should you reserve ? what do you do when it’s exhausted ?

    Most of the times, logging is not the primary goal of your application; it’s tacked on for investigation purposes. Because it’s not essential, it should be unintrisive:

    • does not work ? well, no reason the application should go down
    • slow as hell ? well, no reason the application should be slowed down
    • …

    Let an offline process do the heavy work and reconciliate the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few ASP.Net database front-end websites where MS Access is the back-end.
I have few graphic effects on image which i am able to run on
I have a few dynamic pages and I want to alter certain elements before
I have few questions: 1) why when I created more than two dynamic allocated
I have a few questions regarding JRebel and Java's Dynamic Class Laoding. Say for
I have a ASP dynamic scaffolding project in which I am customizing a details
I have a dilemma, maybe you can help me. I have a table which
I have a few questions about google app engine / datastore and storing dynamic
in my Windows C++ program I have a few dependencies on DLLs (coming with
I have few dynamic dropdowns that the created on change of a dropdownlist, on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.