497
495
return SuccessfulSmartServerResponse((answer,))
500
# In the 'info' attribute, we store whether this request is 'safe' to retry if
501
# we get a disconnect while reading the response. It can have the values:
502
# read This is purely a read request, so retrying it is perfectly ok.
503
# idem An idempotent write request. Something like 'put' where if you put
504
# the same bytes twice you end up with the same final bytes.
505
# semi This is a request that isn't strictly idempotent, but doesn't
506
# result in corruption if it is retried. This is for things like
507
# 'lock' and 'unlock'. If you call lock, it updates the disk
508
# structure. If you fail to read the response, you won't be able to
509
# use the lock, because you don't have the lock token. Calling lock
510
# again will fail, because the lock is already taken. However, we
511
# can't tell if the server received our request or not. If it didn't,
512
# then retrying the request is fine, as it will actually do what we
513
# want. If it did, we will interrupt the current operation, but we
514
# are no worse off than interrupting the current operation because of
516
# semivfs Similar to semi, but specific to a Virtual FileSystem request.
517
# stream This is a request that takes a stream that cannot be restarted if
518
# consumed. This request is 'safe' in that if we determine the
519
# connection is closed before we consume the stream, we can try
521
# mutate State is updated in a way that replaying that request results in a
522
# different state. For example 'append' writes more bytes to a given
523
# file. If append succeeds, it moves the file pointer.
524
498
request_handlers = registry.Registry()
525
499
request_handlers.register_lazy(
526
'append', 'bzrlib.smart.vfs', 'AppendRequest', info='mutate')
500
'append', 'bzrlib.smart.vfs', 'AppendRequest')
527
501
request_handlers.register_lazy(
528
502
'Branch.break_lock', 'bzrlib.smart.branch',
529
'SmartServerBranchBreakLock', info='idem')
503
'SmartServerBranchBreakLock')
530
504
request_handlers.register_lazy(
531
505
'Branch.get_config_file', 'bzrlib.smart.branch',
532
'SmartServerBranchGetConfigFile', info='read')
533
request_handlers.register_lazy(
534
'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent',
506
'SmartServerBranchGetConfigFile')
536
507
request_handlers.register_lazy(
537
508
'Branch.put_config_file', 'bzrlib.smart.branch',
538
'SmartServerBranchPutConfigFile', info='idem')
509
'SmartServerBranchPutConfigFile')
510
request_handlers.register_lazy(
511
'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent')
539
512
request_handlers.register_lazy(
540
513
'Branch.get_tags_bytes', 'bzrlib.smart.branch',
541
'SmartServerBranchGetTagsBytes', info='read')
514
'SmartServerBranchGetTagsBytes')
542
515
request_handlers.register_lazy(
543
516
'Branch.set_tags_bytes', 'bzrlib.smart.branch',
544
'SmartServerBranchSetTagsBytes', info='idem')
517
'SmartServerBranchSetTagsBytes')
545
518
request_handlers.register_lazy(
546
519
'Branch.heads_to_fetch', 'bzrlib.smart.branch',
547
'SmartServerBranchHeadsToFetch', info='read')
548
request_handlers.register_lazy(
549
'Branch.get_stacked_on_url', 'bzrlib.smart.branch',
550
'SmartServerBranchRequestGetStackedOnURL', info='read')
520
'SmartServerBranchHeadsToFetch')
521
request_handlers.register_lazy(
522
'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
523
request_handlers.register_lazy(
524
'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
525
request_handlers.register_lazy(
526
'Branch.lock_write', 'bzrlib.smart.branch', 'SmartServerBranchRequestLockWrite')
551
527
request_handlers.register_lazy(
552
528
'Branch.get_physical_lock_status', 'bzrlib.smart.branch',
553
'SmartServerBranchRequestGetPhysicalLockStatus', info='read')
554
request_handlers.register_lazy(
555
'Branch.last_revision_info', 'bzrlib.smart.branch',
556
'SmartServerBranchRequestLastRevisionInfo', info='read')
557
request_handlers.register_lazy(
558
'Branch.lock_write', 'bzrlib.smart.branch',
559
'SmartServerBranchRequestLockWrite', info='semi')
560
request_handlers.register_lazy(
561
'Branch.revision_history', 'bzrlib.smart.branch',
562
'SmartServerRequestRevisionHistory', info='read')
563
request_handlers.register_lazy(
564
'Branch.set_config_option', 'bzrlib.smart.branch',
565
'SmartServerBranchRequestSetConfigOption', info='idem')
566
request_handlers.register_lazy(
567
'Branch.set_config_option_dict', 'bzrlib.smart.branch',
568
'SmartServerBranchRequestSetConfigOptionDict', info='idem')
569
request_handlers.register_lazy(
570
'Branch.set_last_revision', 'bzrlib.smart.branch',
571
'SmartServerBranchRequestSetLastRevision', info='idem')
529
'SmartServerBranchRequestGetPhysicalLockStatus')
530
request_handlers.register_lazy( 'Branch.revision_history',
531
'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
532
request_handlers.register_lazy( 'Branch.set_config_option',
533
'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption')
534
request_handlers.register_lazy( 'Branch.set_config_option_dict',
535
'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOptionDict')
536
request_handlers.register_lazy( 'Branch.set_last_revision',
537
'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
572
538
request_handlers.register_lazy(
573
539
'Branch.set_last_revision_info', 'bzrlib.smart.branch',
574
'SmartServerBranchRequestSetLastRevisionInfo', info='idem')
540
'SmartServerBranchRequestSetLastRevisionInfo')
575
541
request_handlers.register_lazy(
576
542
'Branch.set_last_revision_ex', 'bzrlib.smart.branch',
577
'SmartServerBranchRequestSetLastRevisionEx', info='idem')
543
'SmartServerBranchRequestSetLastRevisionEx')
578
544
request_handlers.register_lazy(
579
545
'Branch.set_parent_location', 'bzrlib.smart.branch',
580
'SmartServerBranchRequestSetParentLocation', info='idem')
581
request_handlers.register_lazy(
582
'Branch.unlock', 'bzrlib.smart.branch',
583
'SmartServerBranchRequestUnlock', info='semi')
584
request_handlers.register_lazy(
585
'Branch.revision_id_to_revno', 'bzrlib.smart.branch',
586
'SmartServerBranchRequestRevisionIdToRevno', info='read')
587
request_handlers.register_lazy(
588
'BzrDir.checkout_metadir', 'bzrlib.smart.bzrdir',
589
'SmartServerBzrDirRequestCheckoutMetaDir', info='read')
546
'SmartServerBranchRequestSetParentLocation')
547
request_handlers.register_lazy(
548
'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock')
549
request_handlers.register_lazy(
550
'Branch.revision_id_to_revno', 'bzrlib.smart.branch', 'SmartServerBranchRequestRevisionIdToRevno')
590
551
request_handlers.register_lazy(
591
552
'BzrDir.cloning_metadir', 'bzrlib.smart.bzrdir',
592
'SmartServerBzrDirRequestCloningMetaDir', info='read')
553
'SmartServerBzrDirRequestCloningMetaDir')
593
554
request_handlers.register_lazy(
594
555
'BzrDir.create_branch', 'bzrlib.smart.bzrdir',
595
'SmartServerRequestCreateBranch', info='semi')
556
'SmartServerRequestCreateBranch')
596
557
request_handlers.register_lazy(
597
558
'BzrDir.create_repository', 'bzrlib.smart.bzrdir',
598
'SmartServerRequestCreateRepository', info='semi')
559
'SmartServerRequestCreateRepository')
599
560
request_handlers.register_lazy(
600
561
'BzrDir.find_repository', 'bzrlib.smart.bzrdir',
601
'SmartServerRequestFindRepositoryV1', info='read')
562
'SmartServerRequestFindRepositoryV1')
602
563
request_handlers.register_lazy(
603
564
'BzrDir.find_repositoryV2', 'bzrlib.smart.bzrdir',
604
'SmartServerRequestFindRepositoryV2', info='read')
565
'SmartServerRequestFindRepositoryV2')
605
566
request_handlers.register_lazy(
606
567
'BzrDir.find_repositoryV3', 'bzrlib.smart.bzrdir',
607
'SmartServerRequestFindRepositoryV3', info='read')
568
'SmartServerRequestFindRepositoryV3')
608
569
request_handlers.register_lazy(
609
570
'BzrDir.get_config_file', 'bzrlib.smart.bzrdir',
610
'SmartServerBzrDirRequestConfigFile', info='read')
571
'SmartServerBzrDirRequestConfigFile')
611
572
request_handlers.register_lazy(
612
573
'BzrDir.destroy_branch', 'bzrlib.smart.bzrdir',
613
'SmartServerBzrDirRequestDestroyBranch', info='semi')
574
'SmartServerBzrDirRequestDestroyBranch')
614
575
request_handlers.register_lazy(
615
576
'BzrDir.destroy_repository', 'bzrlib.smart.bzrdir',
616
'SmartServerBzrDirRequestDestroyRepository', info='semi')
577
'SmartServerBzrDirRequestDestroyRepository')
617
578
request_handlers.register_lazy(
618
579
'BzrDir.has_workingtree', 'bzrlib.smart.bzrdir',
619
'SmartServerBzrDirRequestHasWorkingTree', info='read')
580
'SmartServerBzrDirRequestHasWorkingTree')
620
581
request_handlers.register_lazy(
621
582
'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',
622
'SmartServerRequestInitializeBzrDir', info='semi')
583
'SmartServerRequestInitializeBzrDir')
623
584
request_handlers.register_lazy(
624
585
'BzrDirFormat.initialize_ex_1.16', 'bzrlib.smart.bzrdir',
625
'SmartServerRequestBzrDirInitializeEx', info='semi')
626
request_handlers.register_lazy(
627
'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir',
629
request_handlers.register_lazy(
630
'BzrDir.open_2.1', 'bzrlib.smart.bzrdir',
631
'SmartServerRequestOpenBzrDir_2_1', info='read')
586
'SmartServerRequestBzrDirInitializeEx')
587
request_handlers.register_lazy(
588
'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')
589
request_handlers.register_lazy(
590
'BzrDir.open_2.1', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir_2_1')
632
591
request_handlers.register_lazy(
633
592
'BzrDir.open_branch', 'bzrlib.smart.bzrdir',
634
'SmartServerRequestOpenBranch', info='read')
593
'SmartServerRequestOpenBranch')
635
594
request_handlers.register_lazy(
636
595
'BzrDir.open_branchV2', 'bzrlib.smart.bzrdir',
637
'SmartServerRequestOpenBranchV2', info='read')
596
'SmartServerRequestOpenBranchV2')
638
597
request_handlers.register_lazy(
639
598
'BzrDir.open_branchV3', 'bzrlib.smart.bzrdir',
640
'SmartServerRequestOpenBranchV3', info='read')
641
request_handlers.register_lazy(
642
'delete', 'bzrlib.smart.vfs', 'DeleteRequest', info='semivfs')
643
request_handlers.register_lazy(
644
'get', 'bzrlib.smart.vfs', 'GetRequest', info='read')
645
request_handlers.register_lazy(
646
'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest', info='read')
647
request_handlers.register_lazy(
648
'has', 'bzrlib.smart.vfs', 'HasRequest', info='read')
649
request_handlers.register_lazy(
650
'hello', 'bzrlib.smart.request', 'HelloRequest', info='read')
651
request_handlers.register_lazy(
652
'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest',
654
request_handlers.register_lazy(
655
'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest', info='read')
656
request_handlers.register_lazy(
657
'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest', info='semivfs')
658
request_handlers.register_lazy(
659
'move', 'bzrlib.smart.vfs', 'MoveRequest', info='semivfs')
660
request_handlers.register_lazy(
661
'put', 'bzrlib.smart.vfs', 'PutRequest', info='idem')
662
request_handlers.register_lazy(
663
'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest', info='idem')
664
request_handlers.register_lazy(
665
'readv', 'bzrlib.smart.vfs', 'ReadvRequest', info='read')
666
request_handlers.register_lazy(
667
'rename', 'bzrlib.smart.vfs', 'RenameRequest', info='semivfs')
599
'SmartServerRequestOpenBranchV3')
600
request_handlers.register_lazy(
601
'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
602
request_handlers.register_lazy(
603
'get', 'bzrlib.smart.vfs', 'GetRequest')
604
request_handlers.register_lazy(
605
'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest')
606
request_handlers.register_lazy(
607
'has', 'bzrlib.smart.vfs', 'HasRequest')
608
request_handlers.register_lazy(
609
'hello', 'bzrlib.smart.request', 'HelloRequest')
610
request_handlers.register_lazy(
611
'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest')
612
request_handlers.register_lazy(
613
'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest')
614
request_handlers.register_lazy(
615
'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest')
616
request_handlers.register_lazy(
617
'move', 'bzrlib.smart.vfs', 'MoveRequest')
618
request_handlers.register_lazy(
619
'put', 'bzrlib.smart.vfs', 'PutRequest')
620
request_handlers.register_lazy(
621
'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest')
622
request_handlers.register_lazy(
623
'readv', 'bzrlib.smart.vfs', 'ReadvRequest')
624
request_handlers.register_lazy(
625
'rename', 'bzrlib.smart.vfs', 'RenameRequest')
626
request_handlers.register_lazy(
627
'PackRepository.autopack', 'bzrlib.smart.packrepository',
628
'SmartServerPackRepositoryAutopack')
629
request_handlers.register_lazy('Repository.all_revision_ids',
630
'bzrlib.smart.repository',
631
'SmartServerRepositoryAllRevisionIds')
632
request_handlers.register_lazy('Repository.break_lock',
633
'bzrlib.smart.repository',
634
'SmartServerRepositoryBreakLock')
635
request_handlers.register_lazy('Repository.gather_stats',
636
'bzrlib.smart.repository',
637
'SmartServerRepositoryGatherStats')
638
request_handlers.register_lazy('Repository.get_parent_map',
639
'bzrlib.smart.repository',
640
'SmartServerRepositoryGetParentMap')
668
641
request_handlers.register_lazy(
669
642
'Repository.add_signature_text', 'bzrlib.smart.repository',
670
'SmartServerRepositoryAddSignatureText', info='idem')
671
request_handlers.register_lazy(
672
'Repository.all_revision_ids', 'bzrlib.smart.repository',
673
'SmartServerRepositoryAllRevisionIds', info='read')
674
request_handlers.register_lazy(
675
'PackRepository.autopack', 'bzrlib.smart.packrepository',
676
'SmartServerPackRepositoryAutopack', info='idem')
677
request_handlers.register_lazy(
678
'Repository.break_lock', 'bzrlib.smart.repository',
679
'SmartServerRepositoryBreakLock', info='idem')
680
request_handlers.register_lazy(
681
'Repository.gather_stats', 'bzrlib.smart.repository',
682
'SmartServerRepositoryGatherStats', info='read')
683
request_handlers.register_lazy(
684
'Repository.get_parent_map', 'bzrlib.smart.repository',
685
'SmartServerRepositoryGetParentMap', info='read')
686
request_handlers.register_lazy(
687
'Repository.get_revision_graph', 'bzrlib.smart.repository',
688
'SmartServerRepositoryGetRevisionGraph', info='read')
643
'SmartServerRepositoryAddSignatureText')
644
request_handlers.register_lazy(
645
'Repository.get_revision_graph', 'bzrlib.smart.repository', 'SmartServerRepositoryGetRevisionGraph')
689
646
request_handlers.register_lazy(
690
647
'Repository.get_revision_signature_text', 'bzrlib.smart.repository',
691
'SmartServerRepositoryGetRevisionSignatureText', info='read')
648
'SmartServerRepositoryGetRevisionSignatureText')
692
649
request_handlers.register_lazy(
693
'Repository.has_revision', 'bzrlib.smart.repository',
694
'SmartServerRequestHasRevision', info='read')
650
'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
695
651
request_handlers.register_lazy(
696
652
'Repository.has_signature_for_revision_id', 'bzrlib.smart.repository',
697
'SmartServerRequestHasSignatureForRevisionId', info='read')
698
request_handlers.register_lazy(
699
'Repository.insert_stream', 'bzrlib.smart.repository',
700
'SmartServerRepositoryInsertStream', info='stream')
701
request_handlers.register_lazy(
702
'Repository.insert_stream_1.19', 'bzrlib.smart.repository',
703
'SmartServerRepositoryInsertStream_1_19', info='stream')
704
request_handlers.register_lazy(
705
'Repository.insert_stream_locked', 'bzrlib.smart.repository',
706
'SmartServerRepositoryInsertStreamLocked', info='stream')
707
request_handlers.register_lazy(
708
'Repository.is_shared', 'bzrlib.smart.repository',
709
'SmartServerRepositoryIsShared', info='read')
653
'SmartServerRequestHasSignatureForRevisionId')
654
request_handlers.register_lazy(
655
'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
656
request_handlers.register_lazy(
657
'Repository.insert_stream_1.19', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream_1_19')
658
request_handlers.register_lazy(
659
'Repository.insert_stream_locked', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStreamLocked')
660
request_handlers.register_lazy(
661
'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
710
662
request_handlers.register_lazy(
711
663
'Repository.iter_files_bytes', 'bzrlib.smart.repository',
712
'SmartServerRepositoryIterFilesBytes', info='read')
713
request_handlers.register_lazy(
714
'Repository.lock_write', 'bzrlib.smart.repository',
715
'SmartServerRepositoryLockWrite', info='semi')
716
request_handlers.register_lazy(
717
'Repository.make_working_trees', 'bzrlib.smart.repository',
718
'SmartServerRepositoryMakeWorkingTrees', info='read')
664
'SmartServerRepositoryIterFilesBytes')
665
request_handlers.register_lazy(
666
'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
667
request_handlers.register_lazy(
668
'Repository.make_working_trees', 'bzrlib.smart.repository', 'SmartServerRepositoryMakeWorkingTrees')
719
669
request_handlers.register_lazy(
720
670
'Repository.set_make_working_trees', 'bzrlib.smart.repository',
721
'SmartServerRepositorySetMakeWorkingTrees', info='idem')
671
'SmartServerRepositorySetMakeWorkingTrees')
722
672
request_handlers.register_lazy(
723
'Repository.unlock', 'bzrlib.smart.repository',
724
'SmartServerRepositoryUnlock', info='semi')
673
'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
725
674
request_handlers.register_lazy(
726
675
'Repository.get_physical_lock_status', 'bzrlib.smart.repository',
727
'SmartServerRepositoryGetPhysicalLockStatus', info='read')
676
'SmartServerRepositoryGetPhysicalLockStatus')
728
677
request_handlers.register_lazy(
729
678
'Repository.get_rev_id_for_revno', 'bzrlib.smart.repository',
730
'SmartServerRepositoryGetRevIdForRevno', info='read')
679
'SmartServerRepositoryGetRevIdForRevno')
731
680
request_handlers.register_lazy(
732
681
'Repository.get_stream', 'bzrlib.smart.repository',
733
'SmartServerRepositoryGetStream', info='read')
682
'SmartServerRepositoryGetStream')
734
683
request_handlers.register_lazy(
735
684
'Repository.get_stream_1.19', 'bzrlib.smart.repository',
736
'SmartServerRepositoryGetStream_1_19', info='read')
685
'SmartServerRepositoryGetStream_1_19')
737
686
request_handlers.register_lazy(
738
687
'Repository.iter_revisions', 'bzrlib.smart.repository',
739
'SmartServerRepositoryIterRevisions', info='read')
688
'SmartServerRepositoryIterRevisions')
740
689
request_handlers.register_lazy(
741
690
'Repository.pack', 'bzrlib.smart.repository',
742
'SmartServerRepositoryPack', info='idem')
691
'SmartServerRepositoryPack')
692
request_handlers.register_lazy(
693
'Repository.tarball', 'bzrlib.smart.repository',
694
'SmartServerRepositoryTarball')
743
695
request_handlers.register_lazy(
744
696
'Repository.start_write_group', 'bzrlib.smart.repository',
745
'SmartServerRepositoryStartWriteGroup', info='semi')
697
'SmartServerRepositoryStartWriteGroup')
746
698
request_handlers.register_lazy(
747
699
'Repository.commit_write_group', 'bzrlib.smart.repository',
748
'SmartServerRepositoryCommitWriteGroup', info='semi')
700
'SmartServerRepositoryCommitWriteGroup')
749
701
request_handlers.register_lazy(
750
702
'Repository.abort_write_group', 'bzrlib.smart.repository',
751
'SmartServerRepositoryAbortWriteGroup', info='semi')
703
'SmartServerRepositoryAbortWriteGroup')
752
704
request_handlers.register_lazy(
753
705
'Repository.check_write_group', 'bzrlib.smart.repository',
754
'SmartServerRepositoryCheckWriteGroup', info='read')
755
request_handlers.register_lazy(
756
'Repository.reconcile', 'bzrlib.smart.repository',
757
'SmartServerRepositoryReconcile', info='idem')
758
request_handlers.register_lazy(
759
'Repository.tarball', 'bzrlib.smart.repository',
760
'SmartServerRepositoryTarball', info='read')
706
'SmartServerRepositoryCheckWriteGroup')
761
707
request_handlers.register_lazy(
762
708
'VersionedFileRepository.get_serializer_format', 'bzrlib.smart.repository',
763
'SmartServerRepositoryGetSerializerFormat', info='read')
764
request_handlers.register_lazy(
765
'VersionedFileRepository.get_inventories', 'bzrlib.smart.repository',
766
'SmartServerRepositoryGetInventories', info='read')
767
request_handlers.register_lazy(
768
'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest', info='semivfs')
769
request_handlers.register_lazy(
770
'stat', 'bzrlib.smart.vfs', 'StatRequest', info='read')
771
request_handlers.register_lazy(
772
'Transport.is_readonly', 'bzrlib.smart.request',
773
'SmartServerIsReadonly', info='read')
709
'SmartServerRepositoryGetSerializerFormat')
710
request_handlers.register_lazy(
711
'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest')
712
request_handlers.register_lazy(
713
'stat', 'bzrlib.smart.vfs', 'StatRequest')
714
request_handlers.register_lazy(
715
'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly')